summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-11 07:25:08 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-11 07:25:08 +0000
commit1806c2795bdccce6ad20d448b90836ed43e70124 (patch)
tree5efb41e55edce14d0dea22b3bd7ddc8b8f1fb5a6 /clang/lib
parent19a9f42f20b10865385877bdb42619020dc95270 (diff)
downloadbcm5719-llvm-1806c2795bdccce6ad20d448b90836ed43e70124.tar.gz
bcm5719-llvm-1806c2795bdccce6ad20d448b90836ed43e70124.zip
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. llvm-svn: 81515
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp4
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp2
-rw-r--r--clang/lib/Sema/SemaType.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 63c29de82b4..8bb33eb9854 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/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/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index e719bbde923..6a5235229a8 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/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/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 9f951989a73..bbcb1a46899 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud