From: Douglas Gregor Date: Wed, 4 May 2011 23:05:40 +0000 (+0000) Subject: Clean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd61e341d6efb9b3eaee97e48f98876af128349c;p=clang Clean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc 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 . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130882 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index 7049f6b01d..5ee256ab21 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -546,25 +546,33 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, InjectedClassNameTypeLoc InjectedTL = TLB.push(T); InjectedTL.setNameLoc(IdentifierLoc); - } else if (isa(SD)) { + } else if (isa(T)) { RecordTypeLoc RecordTL = TLB.push(T); RecordTL.setNameLoc(IdentifierLoc); - } else if (isa(SD)) { + } else if (isa(T)) { TypedefTypeLoc TypedefTL = TLB.push(T); TypedefTL.setNameLoc(IdentifierLoc); - } else if (isa(SD)) { + } else if (isa(T)) { EnumTypeLoc EnumTL = TLB.push(T); EnumTL.setNameLoc(IdentifierLoc); - } else if (isa(SD)) { + } else if (isa(T)) { TemplateTypeParmTypeLoc TemplateTypeTL = TLB.push(T); TemplateTypeTL.setNameLoc(IdentifierLoc); - } else { - assert(isa(SD) && - "Unhandled TypeDecl node in nested-name-specifier"); + } else if (isa(T)) { UnresolvedUsingTypeLoc UnresolvedTL = TLB.push(T); UnresolvedTL.setNameLoc(IdentifierLoc); + } else if (isa(T)) { + SubstTemplateTypeParmTypeLoc TL + = TLB.push(T); + TL.setNameLoc(IdentifierLoc); + } else if (isa(T)) { + SubstTemplateTypeParmPackTypeLoc TL + = TLB.push(T); + TL.setNameLoc(IdentifierLoc); + } else { + llvm_unreachable("Unhandled TypeDecl node in nested-name-specifier"); } SS.Extend(Context, SourceLocation(), TLB.getTypeLocInContext(Context, T),