EricWF marked an inline comment as done.
EricWF added a comment.
In https://reviews.llvm.org/D23385#513443, @rsmith wrote:
> Have you considered modelling this as an attribute on the declaration of the
> variable instead of as a separate check? If so, why do you prefer this
> approach? (If I we
rsmith added a comment.
Have you considered modelling this as an attribute on the declaration of the
variable instead of as a separate check? If so, why do you prefer this
approach? (If I were to suggest this for standardization, an attribute is the
approach I'd probably take.)
==
jroelofs added a comment.
I don't think I have any more comments, but I'll let one of the other reviewers
give the final go/no-go.
Comment at: docs/LanguageExtensions.rst:1047
@@ +1046,3 @@
+ Determines whether `expr` names
+ a object that will be initialized during
+ `const
EricWF marked an inline comment as done.
Comment at: lib/Sema/SemaExprCXX.cpp:4775
@@ +4774,3 @@
+ // duration. AObjects with automatic or dynamic lifetime never have
+ // a 'constant initializer'.
+ if ((VD->hasGlobalStorage() ||
I've added docs to
EricWF updated this revision to Diff 67790.
EricWF marked an inline comment as done.
EricWF added a comment.
- Add documentation for `__has_constant_initializer` and expression traits in
general.
- Make expression traits detectable using `__has_extension`.
https://reviews.llvm.org/D23385
Files
EricWF updated this revision to Diff 67776.
EricWF added a comment.
- Apply @jroelof's suggestions
- Add tests for static class members
https://reviews.llvm.org/D23385
Files:
include/clang/AST/Expr.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/ExpressionTraits.h
inclu
jroelofs added inline comments.
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6807
@@ +6806,3 @@
+
+def err_has_constant_init_expression_trait_invalid_arg : Error<
+ "expression does not reference a named variable">;
EricWF wrote:
> Help improving this w
EricWF added inline comments.
Comment at: lib/Sema/SemaExprCXX.cpp:4775
@@ +4774,3 @@
+ // a 'constant initializer'.
+ else if ((VD->hasGlobalStorage() ||
+ VD->getTLSKind() != VarDecl::TLS_None) && VD->hasInit()) {
EricWF wrote:
> jroelofs wrot
EricWF marked an inline comment as done.
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6807
@@ +6806,3 @@
+
+def err_has_constant_init_expression_trait_invalid_arg : Error<
+ "expression does not reference a named variable">;
Help improving this wording
jroelofs added a comment.
One more thing: need to add docs to `clang/docs/LanguageExtensions.rst`.
https://reviews.llvm.org/D23385
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jroelofs added a subscriber: jroelofs.
Comment at: lib/AST/Expr.cpp:2656
@@ +2655,3 @@
+AllowNonLiteral)) {
+if (!CE->getNumArgs()) return true;
+unsigned numArgs = CE->getNumArgs();
no need for this `if`.
Also, I think the `for` shoul
EricWF updated this revision to Diff 67768.
EricWF added a comment.
Re-flow comments because I suck at English.
https://reviews.llvm.org/D23385
Files:
include/clang/AST/Expr.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/ExpressionTraits.h
include/clang/Basic/TokenKind
EricWF updated this revision to Diff 67635.
EricWF added a comment.
Check the initializers of TLS_Dynamic variables since they may actually be
non-dynamic.
https://reviews.llvm.org/D23385
Files:
include/clang/AST/Expr.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/Expre
EricWF added a comment.
Open questions:
- What should __has_constant_initializer do for non-static inputs? Currently it
returns false.
- Do I need to do more to handle value dependent inputs?
- Should expression traits SFINAE?
https://reviews.llvm.org/D23385
__
EricWF created this revision.
EricWF added reviewers: aaron.ballman, rsmith, majnemer.
EricWF added a subscriber: cfe-commits.
Safe static initialization is hard to do correctly in C++. The static
initialization order fiasco often causes bugs when variables are dynamically
initialized. However
15 matches
Mail list logo