diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 02:55:12 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 02:55:12 +0000 |
| commit | 242ad89a15d5466d166d47978bfff983d40ab511 (patch) | |
| tree | 6dbdd5a89a0874ea2545ebb1c6d6089fbc5dfa49 /clang/lib/Sema/SemaExpr.cpp | |
| parent | b9ccd553fca066e8f5e1353e612ef91bb85d20d1 (diff) | |
| download | bcm5719-llvm-242ad89a15d5466d166d47978bfff983d40ab511.tar.gz bcm5719-llvm-242ad89a15d5466d166d47978bfff983d40ab511.zip | |
C++11 half of r147023: In C++11, additionally eagerly instantiate:
- constexpr function template instantiations
- variables of reference type
- constexpr variables
llvm-svn: 147031
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3a61fe50666..9d2298a704b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9491,6 +9491,11 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) { cast<CXXRecordDecl>(Function->getDeclContext())->isLocalClass()) PendingLocalImplicitInstantiations.push_back(std::make_pair(Function, Loc)); + else if (Function->getTemplateInstantiationPattern()->isConstexpr()) + // Do not defer instantiations of constexpr functions, to avoid the + // expression evaluator needing to call back into Sema if it sees a + // call to such a function. + InstantiateFunctionDefinition(Loc, Function); else PendingInstantiations.push_back(std::make_pair(Function, Loc)); } @@ -9526,9 +9531,9 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) { // This is a modification of an existing AST node. Notify listeners. if (ASTMutationListener *L = getASTMutationListener()) L->StaticDataMemberInstantiated(Var); - QualType T = Var->getType(); - if (T.isConstQualified() && !T.isVolatileQualified() && - T->isIntegralOrEnumerationType()) + if (Var->isUsableInConstantExpressions()) + // Do not defer instantiations of variables which could be used in a + // constant expression. InstantiateStaticDataMemberDefinition(Loc, Var); else PendingInstantiations.push_back(std::make_pair(Var, Loc)); |

