diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 19 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 3 |
3 files changed, 10 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index fc16b9bbaf5..d68c851d63a 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -10751,8 +10751,7 @@ void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, // not have a vtable. if (!Class->isDynamicClass() || Class->isDependentContext() || CurContext->isDependentContext() || - ExprEvalContexts.back().Context == Unevaluated || - ExprEvalContexts.back().Context == ConstantEvaluated) + ExprEvalContexts.back().Context == Unevaluated) return; // Try to insert this class into the map. diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 613fb73c952..96496662503 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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())) { diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e1bd8139552..e7b899278f5 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1059,8 +1059,7 @@ static QualType inferARCLifetimeForPointee(Sema &S, QualType type, // If we are in an unevaluated context, like sizeof, skip adding a // qualification. - } else if (S.ExprEvalContexts.back().Context == Sema::Unevaluated || - S.ExprEvalContexts.back().Context == Sema::ConstantEvaluated) { + } else if (S.ExprEvalContexts.back().Context == Sema::Unevaluated) { return type; // If that failed, give an error and recover using __autoreleasing. |

