aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-21 04:44:06 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-21 04:44:06 +0000
commit78a542478dd63c2789816dcc1cdab5c9a6eef99b (patch)
tree62ae9ce01e0011b91fb3bb75e7dae52d6a431a85 /lib/Sema/SemaExpr.cpp
parent65ba94814f667e6ea1fcbf0896ad496bb7010335 (diff)
Fix some comments relating to ExpressionEvaluationContexts. Get rid of a couple of uses of ConstantEvaluated which don't make sense.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 613fb73c95..9649666250 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9477,21 +9477,16 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
switch (ExprEvalContexts.back().Context) {
case Unevaluated:
// We are in an expression that is not potentially evaluated; do nothing.
+ // (Depending on how you read the standard, we actually do need to do
+ // something here for null pointer constants, but the standard's
+ // definition of a null pointer constant is completely crazy.)
return;
case ConstantEvaluated:
- // We are in an expression that will be evaluated during translation; in
- // C++11, we need to define any functions which are used in case they're
- // constexpr, whereas in C++98, we only need to define static data members
- // of class templates.
- if (!getLangOptions().CPlusPlus ||
- (!getLangOptions().CPlusPlus0x && !isa<VarDecl>(D)))
- return;
- break;
-
case PotentiallyEvaluated:
- // We are in a potentially-evaluated expression, so this declaration is
- // "used"; handle this below.
+ // We are in a potentially evaluated expression (or a constant-expression
+ // in C++03); we need to do implicit template instantiation, implicitly
+ // define class members, and mark most declarations as used.
break;
case PotentiallyEvaluatedIfUsed:
@@ -9616,6 +9611,8 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
// Keep track of used but undefined variables. We make a hole in
// the warning for static const data members with in-line
// initializers.
+ // FIXME: The hole we make for static const data members is too wide!
+ // We need to implement the C++11 rules for odr-used.
if (Var->hasDefinition() == VarDecl::DeclarationOnly
&& Var->getLinkage() != ExternalLinkage
&& !(Var->isStaticDataMember() && Var->hasInit())) {