]> granicus.if.org Git - clang/commitdiff
Fix PR9390 in not one, but two ways:
authorDouglas Gregor <dgregor@apple.com>
Thu, 3 Mar 2011 21:48:55 +0000 (21:48 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 3 Mar 2011 21:48:55 +0000 (21:48 +0000)
  1) When we do an instantiation of the injected-class-name type,
  provide a proper source location. This is just plain good hygiene.

  2) When we're building a NestedNameSpecifierLoc from a CXXScopeSpec,
  only return an empty NestedNameSpecifierLoc if there's no
  representation.

Both problems contributed to the horrible test case in PR9390 that I
couldn't reduce down to something palatable.

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

lib/Sema/DeclSpec.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp

index 2cb490434793870daa40fd165905ad76e46d8135..df29febe4f94252a21cad5409d2634bf0cee2c4a 100644 (file)
@@ -126,7 +126,7 @@ void CXXScopeSpec::Adopt(NestedNameSpecifierLoc Other) {
 
 NestedNameSpecifierLoc 
 CXXScopeSpec::getWithLocInContext(ASTContext &Context) const {
-  if (isEmpty() || isInvalid())
+  if (!Builder.getRepresentation())
     return NestedNameSpecifierLoc();
   
   return Builder.getWithLocInContext(Context);
index 3a40b6fd77a78ecb9820d2a285bf8e90cd232258..cbbc2d9f89f4f58db2108eb70539568b7288821c 100644 (file)
@@ -2917,7 +2917,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
 
       // FIXME: Can we use the CurrentInstantiationScope to avoid this
       // extra instantiation in the common case?
-      T = SubstType(T, TemplateArgs, SourceLocation(), DeclarationName());
+      T = SubstType(T, TemplateArgs, Loc, DeclarationName());
       assert(!T.isNull() && "Instantiation of injected-class-name cannot fail.");
     
       if (!T->isDependentType()) {