diff options
author | John McCall <rjmccall@apple.com> | 2009-09-11 07:25:08 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-11 07:25:08 +0000 |
commit | 9cc7807e1622c2f945b607bdd39dd283df5e7bb5 (patch) | |
tree | 6f0f78fbe2e91afc5c80350049553e2b4f17b2e0 /lib/Sema | |
parent | 136a6988960ac3aeb96f298da7a1a182db7217cd (diff) |
Track a class template specialization's point of instantiation separately
from its location. Initialize appropriately.
When implicitly creating a declaration of a class template specialization
after encountering the first reference to it, use the pattern class's
location instead of the location of the first reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 63c29de82b..8bb33eb985 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1097,7 +1097,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, // the set of specializations. Decl = ClassTemplateSpecializationDecl::Create(Context, ClassTemplate->getDeclContext(), - TemplateLoc, + ClassTemplate->getLocation(), ClassTemplate, Converted, 0); ClassTemplate->getSpecializations().InsertNode(Decl, InsertPos); @@ -3027,6 +3027,8 @@ Sema::ActOnExplicitInstantiation(Scope *S, Specialization->setLexicalDeclContext(CurContext); CurContext->addDecl(Specialization); + Specialization->setPointOfInstantiation(TemplateNameLoc); + // C++ [temp.explicit]p3: // A definition of a class template or class member template // shall be in scope at the point of the explicit instantiation of diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index e719bbde92..6a5235229a 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -895,7 +895,7 @@ Sema::InstantiateClassTemplateSpecialization( // Note that this is an instantiation. ClassTemplateSpec->setSpecializationKind(TSK); - bool Result = InstantiateClass(ClassTemplateSpec->getLocation(), + bool Result = InstantiateClass(ClassTemplateSpec->getPointOfInstantiation(), ClassTemplateSpec, Pattern, getTemplateInstantiationArgs(ClassTemplateSpec), TSK, diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 9f951989a7..bbcb1a4689 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1784,10 +1784,8 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, if (ClassTemplateSpecializationDecl *ClassTemplateSpec = dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) { if (ClassTemplateSpec->getSpecializationKind() == TSK_Undeclared) { - // Update the class template specialization's location to - // refer to the point of instantiation. if (Loc.isValid()) - ClassTemplateSpec->setLocation(Loc); + ClassTemplateSpec->setPointOfInstantiation(Loc); return InstantiateClassTemplateSpecialization(ClassTemplateSpec, TSK_ImplicitInstantiation, /*Complain=*/diag != 0); |