aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-17 20:34:02 +0000
committerChris Lattner <sabre@nondot.org>2011-02-17 20:34:02 +0000
commit57ad37823e198f977cac605dbfbaefb4daf325e9 (patch)
tree6a224b2610fe145e615126e76e465f9cbdf77401 /lib/Sema/SemaTemplateInstantiate.cpp
parentd8e54990ade0dd5566f8e3aa2e62def08753d1e9 (diff)
Step #2/N of __label__ support: keep pushing LabelDecl forward,
making them be template instantiated in a more normal way and make them handle attributes like other decls. This fixes the used/unused label handling stuff, making it use the same infrastructure as other decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 41e44ad6d1..44f5913d55 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2168,8 +2168,9 @@ bool Sema::Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
llvm::PointerUnion<Decl *, LocalInstantiationScope::DeclArgumentPack *> *
LocalInstantiationScope::findInstantiationOf(const Decl *D) {
- for (LocalInstantiationScope *Current = this; Current;
+ for (LocalInstantiationScope *Current = this; Current;
Current = Current->Outer) {
+
// Check if we found something within this scope.
const Decl *CheckD = D;
do {
@@ -2189,8 +2190,11 @@ LocalInstantiationScope::findInstantiationOf(const Decl *D) {
if (!Current->CombineWithOuterScope)
break;
}
-
- assert(0 && "declaration was not instantiated in this scope!");
+
+ // If we didn't find the decl, then we either have a sema bug, or we have a
+ // forward reference to a label declaration. Return null to indicate that
+ // we have an uninstantiated label.
+ assert(isa<LabelDecl>(D) && "declaration not instantiated in this scope");
return 0;
}