[cfe-commits] r126961 - in /cfe/trunk/lib/Sema: DeclSpec.cpp SemaTemplateInstantiateDecl.cpp

Douglas Gregor dgregor at apple.com
Thu Mar 3 13:48:55 PST 2011


Author: dgregor
Date: Thu Mar  3 15:48:55 2011
New Revision: 126961

URL: http://llvm.org/viewvc/llvm-project?rev=126961&view=rev
Log:
Fix PR9390 in not one, but two ways:

  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.


Modified:
    cfe/trunk/lib/Sema/DeclSpec.cpp
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=126961&r1=126960&r2=126961&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Thu Mar  3 15:48:55 2011
@@ -126,7 +126,7 @@
 
 NestedNameSpecifierLoc 
 CXXScopeSpec::getWithLocInContext(ASTContext &Context) const {
-  if (isEmpty() || isInvalid())
+  if (!Builder.getRepresentation())
     return NestedNameSpecifierLoc();
   
   return Builder.getWithLocInContext(Context);

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=126961&r1=126960&r2=126961&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Mar  3 15:48:55 2011
@@ -2917,7 +2917,7 @@
 
       // 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()) {





More information about the cfe-commits mailing list