]> granicus.if.org Git - clang/commitdiff
Clean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc
authorDouglas Gregor <dgregor@apple.com>
Wed, 4 May 2011 23:05:40 +0000 (23:05 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 4 May 2011 23:05:40 +0000 (23:05 +0000)
information. Rather than looking at the declaration kind to figure out
what TypeLoc to build, look at the type; it makes so much more
sense. Fixes <rdar://problem/9086649>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130882 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCXXScopeSpec.cpp

index 7049f6b01d26515aa3890cb358cc6d2cbb787f29..5ee256ab216ebb9ce71f46bef6c2d72bce833d0d 100644 (file)
@@ -546,25 +546,33 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S,
       InjectedClassNameTypeLoc InjectedTL
         = TLB.push<InjectedClassNameTypeLoc>(T);
       InjectedTL.setNameLoc(IdentifierLoc);
-    } else if (isa<RecordDecl>(SD)) {
+    } else if (isa<RecordType>(T)) {
       RecordTypeLoc RecordTL = TLB.push<RecordTypeLoc>(T);
       RecordTL.setNameLoc(IdentifierLoc);
-    } else if (isa<TypedefNameDecl>(SD)) {
+    } else if (isa<TypedefType>(T)) {
       TypedefTypeLoc TypedefTL = TLB.push<TypedefTypeLoc>(T);
       TypedefTL.setNameLoc(IdentifierLoc);
-    } else if (isa<EnumDecl>(SD)) {
+    } else if (isa<EnumType>(T)) {
       EnumTypeLoc EnumTL = TLB.push<EnumTypeLoc>(T);
       EnumTL.setNameLoc(IdentifierLoc);
-    } else if (isa<TemplateTypeParmDecl>(SD)) {
+    } else if (isa<TemplateTypeParmType>(T)) {
       TemplateTypeParmTypeLoc TemplateTypeTL
         = TLB.push<TemplateTypeParmTypeLoc>(T);
       TemplateTypeTL.setNameLoc(IdentifierLoc);
-    } else {
-      assert(isa<UnresolvedUsingTypenameDecl>(SD) && 
-             "Unhandled TypeDecl node in nested-name-specifier");
+    } else if (isa<UnresolvedUsingType>(T)) {
       UnresolvedUsingTypeLoc UnresolvedTL
         = TLB.push<UnresolvedUsingTypeLoc>(T);
       UnresolvedTL.setNameLoc(IdentifierLoc);
+    } else if (isa<SubstTemplateTypeParmType>(T)) {
+      SubstTemplateTypeParmTypeLoc TL 
+        = TLB.push<SubstTemplateTypeParmTypeLoc>(T);
+      TL.setNameLoc(IdentifierLoc);
+    } else if (isa<SubstTemplateTypeParmPackType>(T)) {
+      SubstTemplateTypeParmPackTypeLoc TL
+        = TLB.push<SubstTemplateTypeParmPackTypeLoc>(T);
+      TL.setNameLoc(IdentifierLoc);
+    } else {
+      llvm_unreachable("Unhandled TypeDecl node in nested-name-specifier");
     }
 
     SS.Extend(Context, SourceLocation(), TLB.getTypeLocInContext(Context, T),