Author: rsmith Date: Wed Sep 4 14:31:21 2019 New Revision: 370986 URL: http://llvm.org/viewvc/llvm-project?rev=370986&view=rev Log: [www] Update attribute reference for 'constinit'.
Modified: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/include/clang/Basic/AttrDocs.td Modified: cfe/trunk/include/clang/Basic/Attr.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=370986&r1=370985&r2=370986&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/Attr.td (original) +++ cfe/trunk/include/clang/Basic/Attr.td Wed Sep 4 14:31:21 2019 @@ -918,7 +918,7 @@ def ConstInit : InheritableAttr { Clang<"require_constant_initialization", 0>]; let Subjects = SubjectList<[GlobalVar], ErrorDiag>; let Accessors = [Accessor<"isConstinit", [Keyword<"constinit">]>]; - let Documentation = [RequireConstantInitDocs]; + let Documentation = [ConstInitDocs]; let LangOpts = [CPlusPlus]; } Modified: cfe/trunk/include/clang/Basic/AttrDocs.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=370986&r1=370985&r2=370986&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/AttrDocs.td (original) +++ cfe/trunk/include/clang/Basic/AttrDocs.td Wed Sep 4 14:31:21 2019 @@ -1408,15 +1408,17 @@ all optional, but the attribute has to h }]; } -def RequireConstantInitDocs : Documentation { +def ConstInitDocs : Documentation { let Category = DocCatVariable; + let Heading = "require_constant_initialization, constinit (C++20)"; let Content = [{ This attribute specifies that the variable to which it is attached is intended to have a `constant initializer <http://en.cppreference.com/w/cpp/language/constant_initialization>`_ according to the rules of [basic.start.static]. The variable is required to have static or thread storage duration. If the initialization of the variable is not a constant initializer an error will be produced. This attribute may -only be used in C++. +only be used in C++; the ``constinit`` spelling is only accepted in C++20 +onwards. Note that in C++03 strict constant expression checking is not done. Instead the attribute reports if Clang can emit the variable as a constant, even if it's @@ -1431,6 +1433,12 @@ for constant initialization have been me between dialects and have subtle pitfalls it's important to fail fast instead of silently falling back on dynamic initialization. +The first use of the attribute on a variable must be part of, or precede, the +initializing declaration of the variable. C++20 requires the ``constinit`` +spelling of the attribute to be present on the initializing declaration if it +is used anywhere. The other spellings can be specified on a forward declaration +and omitted on a later initializing declaration. + .. code-block:: c++ // -std=c++14 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits