summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-09-04 21:31:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-09-04 21:31:21 +0000
commit252d7a862be252286dd9e4798bb7e30688d12556 (patch)
treedc689a10b10eb8217901c35de38331f35da33888
parent028061d4ebeb777e3ad899519b56d7eafcb2faf9 (diff)
downloadbcm5719-llvm-252d7a862be252286dd9e4798bb7e30688d12556.tar.gz
bcm5719-llvm-252d7a862be252286dd9e4798bb7e30688d12556.zip
[www] Update attribute reference for 'constinit'.
llvm-svn: 370986
-rw-r--r--clang/include/clang/Basic/Attr.td2
-rw-r--r--clang/include/clang/Basic/AttrDocs.td12
2 files changed, 11 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index fbf26ec9b95..e31f3cd9b26 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -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];
}
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index 6732e3db8f7..103bc8b9d3b 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -1408,15 +1408,17 @@ all optional, but the attribute has to have at least one clause.
}];
}
-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 met. Since these requirements change
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
OpenPOWER on IntegriCloud