[cfe-commits] r100779 - in /cfe/trunk: include/clang/Parse/ lib/Frontend/ lib/Parse/ lib/Sema/ test/CXX/temp/temp.spec/temp.explicit/ test/SemaCXX/ test/SemaTemplate/

Jeffrey Yasskin jyasskin at google.com
Thu Apr 8 09:38:48 PDT 2010


Author: jyasskin
Date: Thu Apr  8 11:38:48 2010
New Revision: 100779

URL: http://llvm.org/viewvc/llvm-project?rev=100779&view=rev
Log:
Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it.  This fixes several redundant errors and bad
recoveries.

Modified:
    cfe/trunk/include/clang/Parse/Action.h
    cfe/trunk/include/clang/Parse/Parser.h
    cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
    cfe/trunk/lib/Parse/MinimalAction.cpp
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
    cfe/trunk/test/SemaCXX/nested-name-spec.cpp
    cfe/trunk/test/SemaTemplate/instantiate-function-params.cpp
    cfe/trunk/test/SemaTemplate/instantiate-typedef.cpp
    cfe/trunk/test/SemaTemplate/typename-specifier.cpp

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Thu Apr  8 11:38:48 2010
@@ -205,7 +205,7 @@
   /// \returns the type referred to by this identifier, or NULL if the type
   /// does not name an identifier.
   virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
-                              Scope *S, const CXXScopeSpec *SS = 0,
+                              Scope *S, CXXScopeSpec *SS = 0,
                               bool isClassName = false,
                               TypeTy *ObjectType = 0) = 0;
 
@@ -243,7 +243,7 @@
   virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II, 
                                        SourceLocation IILoc,
                                        Scope *S,
-                                       const CXXScopeSpec *SS,
+                                       CXXScopeSpec *SS,
                                        TypeTy *&SuggestedType) {
     return false;
   }
@@ -281,7 +281,7 @@
   ///
   /// \returns the kind of template that this name refers to.
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           UnqualifiedId &Name,
                                           TypeTy *ObjectType,
                                           bool EnteringContext,
@@ -329,7 +329,7 @@
   /// This actual is used in the parsing of pseudo-destructor names to 
   /// distinguish a nested-name-specifier and a "type-name ::" when we
   /// see the token sequence "X :: ~".
-  virtual bool isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS,
+  virtual bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
                                             SourceLocation IdLoc,
                                             IdentifierInfo &II,
                                             TypeTy *ObjectType) {
@@ -371,7 +371,7 @@
   ///
   /// \returns a CXXScopeTy* object representing the C++ scope.
   virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
-                                                  const CXXScopeSpec &SS,
+                                                  CXXScopeSpec &SS,
                                                   SourceLocation IdLoc,
                                                   SourceLocation CCLoc,
                                                   IdentifierInfo &II,
@@ -387,7 +387,7 @@
   ///
   /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier.
   virtual bool IsInvalidUnlessNestedName(Scope *S,
-                                         const CXXScopeSpec &SS,
+                                         CXXScopeSpec &SS,
                                          IdentifierInfo &II,
                                          TypeTy *ObjectType,
                                          bool EnteringContext) {
@@ -428,7 +428,7 @@
   /// ActOnCXXExitDeclaratorScope is called.
   /// The 'SS' should be a non-empty valid CXXScopeSpec.
   /// \returns true if an error occurred, false otherwise.
-  virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
+  virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) {
     return false;
   }
 
@@ -655,7 +655,7 @@
   ///
   /// \returns the declaration to which this tag refers.
   virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                             SourceLocation KWLoc, const CXXScopeSpec &SS,
+                             SourceLocation KWLoc, CXXScopeSpec &SS,
                              IdentifierInfo *Name, SourceLocation NameLoc,
                              AttributeList *Attr, AccessSpecifier AS,
                              MultiTemplateParamsArg TemplateParameterLists,
@@ -1049,7 +1049,7 @@
   /// id-expression or identifier was an ampersand ('&'), indicating that 
   /// we will be taking the address of this expression.
   virtual OwningExprResult ActOnIdExpression(Scope *S,
-                                             const CXXScopeSpec &SS,
+                                             CXXScopeSpec &SS,
                                              UnqualifiedId &Name,
                                              bool HasTrailingLParen,
                                              bool IsAddressOfOperand) {
@@ -1127,7 +1127,7 @@
   virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
                                                  SourceLocation OpLoc,
                                                  tok::TokenKind OpKind,
-                                                 const CXXScopeSpec &SS,
+                                                 CXXScopeSpec &SS,
                                                  UnqualifiedId &Member,
                                                  DeclPtrTy ObjCImpDecl,
                                                  bool HasTrailingLParen) {
@@ -1315,7 +1315,7 @@
   virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
                                         SourceLocation UsingLoc,
                                         SourceLocation NamespcLoc,
-                                        const CXXScopeSpec &SS,
+                                        CXXScopeSpec &SS,
                                         SourceLocation IdentLoc,
                                         IdentifierInfo *NamespcName,
                                         AttributeList *AttrList);
@@ -1326,7 +1326,7 @@
                                            SourceLocation NamespaceLoc,
                                            SourceLocation AliasLoc,
                                            IdentifierInfo *Alias,
-                                           const CXXScopeSpec &SS,
+                                           CXXScopeSpec &SS,
                                            SourceLocation IdentLoc,
                                            IdentifierInfo *Ident) {
     return DeclPtrTy();
@@ -1372,7 +1372,7 @@
                                           AccessSpecifier AS,
                                           bool HasUsingKeyword,
                                           SourceLocation UsingLoc,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           UnqualifiedId &Name,
                                           AttributeList *AttrList,
                                           bool IsTypeName,
@@ -1501,7 +1501,7 @@
   /// \returns the type being destructed.
   virtual TypeTy *getDestructorName(SourceLocation TildeLoc,
                                     IdentifierInfo &II, SourceLocation NameLoc,
-                                    Scope *S, const CXXScopeSpec &SS,
+                                    Scope *S, CXXScopeSpec &SS,
                                     TypeTy *ObjectType,
                                     bool EnteringContext) {
     return getTypeName(II, NameLoc, S, &SS, false, ObjectType);
@@ -1683,7 +1683,7 @@
   virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
                                                      SourceLocation OpLoc,
                                                      tok::TokenKind OpKind,
-                                                     const CXXScopeSpec &SS,
+                                                     CXXScopeSpec &SS,
                                                   UnqualifiedId &FirstTypeName,
                                                      SourceLocation CCLoc,
                                                      SourceLocation TildeLoc,
@@ -1729,7 +1729,7 @@
 
   virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorDecl,
                                             Scope *S,
-                                            const CXXScopeSpec &SS,
+                                            CXXScopeSpec &SS,
                                             IdentifierInfo *MemberOrBase,
                                             TypeTy *TemplateTypeTy,
                                             SourceLocation IdLoc,
@@ -1939,7 +1939,7 @@
   /// \param EnteringContext whether we are entering the context of this
   /// template.
   virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
-                                                const CXXScopeSpec &SS,
+                                                CXXScopeSpec &SS,
                                                 UnqualifiedId &Name,
                                                 TypeTy *ObjectType,
                                                 bool EnteringContext) {
@@ -1995,7 +1995,7 @@
   virtual DeclResult
   ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
                                    SourceLocation KWLoc,
-                                   const CXXScopeSpec &SS,
+                                   CXXScopeSpec &SS,
                                    TemplateTy Template,
                                    SourceLocation TemplateNameLoc,
                                    SourceLocation LAngleLoc,
@@ -2133,7 +2133,7 @@
                              SourceLocation TemplateLoc,
                              unsigned TagSpec,
                              SourceLocation KWLoc,
-                             const CXXScopeSpec &SS,
+                             CXXScopeSpec &SS,
                              IdentifierInfo *Name,
                              SourceLocation NameLoc,
                              AttributeList *Attr) {
@@ -2581,7 +2581,7 @@
   ///
   /// \parame EnteringContext whether we're entering the context of this
   /// scope specifier.
-  virtual void CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
+  virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
                                        bool EnteringContext) { }
   
   /// \brief Code completion for a C++ "using" declaration or directive.
@@ -2863,7 +2863,7 @@
   /// \returns the type referred to by this identifier, or NULL if the type
   /// does not name an identifier.
   virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
-                              Scope *S, const CXXScopeSpec *SS,
+                              Scope *S, CXXScopeSpec *SS,
                               bool isClassName = false,
                               TypeTy *ObjectType = 0);
 
@@ -2873,7 +2873,7 @@
                                   const CXXScopeSpec *SS);
 
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           UnqualifiedId &Name,
                                           TypeTy *ObjectType,
                                           bool EnteringContext,

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Thu Apr  8 11:38:48 2010
@@ -1354,7 +1354,7 @@
   //===--------------------------------------------------------------------===//
   // C++ 9: classes [class] and C structs/unions.
   TypeResult ParseClassName(SourceLocation &EndLocation,
-                            const CXXScopeSpec *SS = 0);
+                            CXXScopeSpec *SS = 0);
   void ParseClassSpecifier(tok::TokenKind TagTokKind, SourceLocation TagLoc,
                            DeclSpec &DS,
                 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),

Modified: cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp Thu Apr  8 11:38:48 2010
@@ -197,7 +197,7 @@
     }
 
     virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                               SourceLocation KWLoc, const CXXScopeSpec &SS,
+                               SourceLocation KWLoc, CXXScopeSpec &SS,
                                IdentifierInfo *Name, SourceLocation NameLoc,
                                AttributeList *Attr, AccessSpecifier AS,
                                MultiTemplateParamsArg TemplateParameterLists,

Modified: cfe/trunk/lib/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/MinimalAction.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/lib/Parse/MinimalAction.cpp Thu Apr  8 11:38:48 2010
@@ -30,7 +30,7 @@
 Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope,
                                               SourceLocation UsingLoc,
                                               SourceLocation NamespcLoc,
-                                              const CXXScopeSpec &SS,
+                                              CXXScopeSpec &SS,
                                               SourceLocation IdentLoc,
                                               IdentifierInfo *NamespcName,
                                               AttributeList *AttrList) {
@@ -47,7 +47,7 @@
                                                 AccessSpecifier AS,
                                                 bool HasUsingKeyword,
                                                 SourceLocation UsingLoc,
-                                                const CXXScopeSpec &SS,
+                                                CXXScopeSpec &SS,
                                                 UnqualifiedId &Name,
                                                 AttributeList *AttrList,
                                                 bool IsTypeName,
@@ -144,7 +144,7 @@
 /// FIXME: Use the passed CXXScopeSpec for accurate C++ type checking.
 Action::TypeTy *
 MinimalAction::getTypeName(IdentifierInfo &II, SourceLocation Loc,
-                           Scope *S, const CXXScopeSpec *SS,
+                           Scope *S, CXXScopeSpec *SS,
                            bool isClassName, TypeTy *ObjectType) {
   if (TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>())
     if (TI->isTypeName)
@@ -161,7 +161,7 @@
 
 TemplateNameKind
 MinimalAction::isTemplateName(Scope *S,
-                              const CXXScopeSpec &SS,
+                              CXXScopeSpec &SS,
                               UnqualifiedId &Name,
                               TypeTy *ObjectType,
                               bool EnteringScope,

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Apr  8 11:38:48 2010
@@ -2583,20 +2583,18 @@
 
   if (getLang().CPlusPlus && D.mayHaveIdentifier()) {
     // ParseDeclaratorInternal might already have parsed the scope.
-    bool afterCXXScope = D.getCXXScopeSpec().isSet();
-    if (!afterCXXScope) {
+    if (D.getCXXScopeSpec().isEmpty()) {
       ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), /*ObjectType=*/0,
                                      true);
-      afterCXXScope = D.getCXXScopeSpec().isSet();
     }
 
-    if (afterCXXScope) {
+    if (D.getCXXScopeSpec().isValid()) {
       if (Actions.ShouldEnterDeclaratorScope(CurScope, D.getCXXScopeSpec()))
         // Change the declaration context for name lookup, until this function
         // is exited (and the declarator has been parsed).
         DeclScopeObj.EnterDeclaratorScope();
-    } 
-    
+    }
+
     if (Tok.is(tok::identifier) || Tok.is(tok::kw_operator) ||
         Tok.is(tok::annot_template_id) || Tok.is(tok::tilde)) {
       // We found something that indicates the start of an unqualified-id.
@@ -2612,7 +2610,10 @@
                              /*AllowDestructorName=*/true, 
                              AllowConstructorName,
                              /*ObjectType=*/0,
-                             D.getName())) {
+                             D.getName()) ||
+          // Once we're past the identifier, if the scope was bad, mark the
+          // whole declarator bad.
+          D.getCXXScopeSpec().isInvalid()) {
         D.SetIdentifier(0, Tok.getLocation());
         D.setInvalidType(true);
       } else {

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu Apr  8 11:38:48 2010
@@ -465,7 +465,7 @@
 ///         simple-template-id
 ///
 Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
-                                          const CXXScopeSpec *SS) {
+                                          CXXScopeSpec *SS) {
   // Check whether we have a template-id that names a type.
   if (Tok.is(tok::annot_template_id)) {
     TemplateIdAnnotation *TemplateId

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Apr  8 11:38:48 2010
@@ -758,14 +758,14 @@
   DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr);
 
   virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
-                              Scope *S, const CXXScopeSpec *SS,
+                              Scope *S, CXXScopeSpec *SS,
                               bool isClassName = false,
                               TypeTy *ObjectType = 0);
   virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S);
   virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II, 
                                        SourceLocation IILoc,
                                        Scope *S,
-                                       const CXXScopeSpec *SS,
+                                       CXXScopeSpec *SS,
                                        TypeTy *&SuggestedType);
   
   virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
@@ -877,7 +877,7 @@
                                     const IdentifierInfo &Name);
 
   virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                             SourceLocation KWLoc, const CXXScopeSpec &SS,
+                             SourceLocation KWLoc, CXXScopeSpec &SS,
                              IdentifierInfo *Name, SourceLocation NameLoc,
                              AttributeList *Attr, AccessSpecifier AS,
                              MultiTemplateParamsArg TemplateParameterLists,
@@ -1407,7 +1407,7 @@
                   bool AllowBuiltinCreation = false);
   bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
                            bool InUnqualifiedLookup = false);
-  bool LookupParsedName(LookupResult &R, Scope *S, const CXXScopeSpec *SS,
+  bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
                         bool AllowBuiltinCreation = false,
                         bool EnteringContext = false);
   ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II);
@@ -1425,7 +1425,7 @@
   void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
                           VisibleDeclConsumer &Consumer);
 
-  bool CorrectTypo(LookupResult &R, Scope *S, const CXXScopeSpec *SS,
+  bool CorrectTypo(LookupResult &R, Scope *S, CXXScopeSpec *SS,
                    DeclContext *MemberContext = 0,
                    bool EnteringContext = false,
                    const ObjCObjectPointerType *OPT = 0);
@@ -1719,12 +1719,12 @@
   virtual SourceRange getExprRange(ExprTy *E) const;
 
   virtual OwningExprResult ActOnIdExpression(Scope *S,
-                                             const CXXScopeSpec &SS,
+                                             CXXScopeSpec &SS,
                                              UnqualifiedId &Name,
                                              bool HasTrailingLParen,
                                              bool IsAddressOfOperand);
 
-  bool DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS, LookupResult &R);
+  bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R);
 
   OwningExprResult LookupInObjCMethod(LookupResult &R,
                                       Scope *S,
@@ -1758,7 +1758,7 @@
                                   const LookupResult &R,
                                   bool HasTrailingLParen);
 
-  OwningExprResult BuildQualifiedDeclarationNameExpr(const CXXScopeSpec &SS,
+  OwningExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
                                                      DeclarationName Name,
                                                      SourceLocation NameLoc);
   OwningExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
@@ -1828,7 +1828,7 @@
                                             QualType BaseType,
                                             SourceLocation OpLoc,
                                             bool IsArrow,
-                                            const CXXScopeSpec &SS,
+                                            CXXScopeSpec &SS,
                                             NamedDecl *FirstQualifierInScope,
                                             DeclarationName Name,
                                             SourceLocation NameLoc,
@@ -1844,7 +1844,7 @@
 
   OwningExprResult LookupMemberExpr(LookupResult &R, Expr *&Base,
                                     bool &IsArrow, SourceLocation OpLoc,
-                                    const CXXScopeSpec &SS,
+                                    CXXScopeSpec &SS,
                                     DeclPtrTy ObjCImpDecl);
 
   bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
@@ -1864,7 +1864,7 @@
   virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
                                                  SourceLocation OpLoc,
                                                  tok::TokenKind OpKind,
-                                                 const CXXScopeSpec &SS,
+                                                 CXXScopeSpec &SS,
                                                  UnqualifiedId &Member,
                                                  DeclPtrTy ObjCImpDecl,
                                                  bool HasTrailingLParen);
@@ -2008,7 +2008,7 @@
   virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
                                         SourceLocation UsingLoc,
                                         SourceLocation NamespcLoc,
-                                        const CXXScopeSpec &SS,
+                                        CXXScopeSpec &SS,
                                         SourceLocation IdentLoc,
                                         IdentifierInfo *NamespcName,
                                         AttributeList *AttrList);
@@ -2019,7 +2019,7 @@
                                            SourceLocation NamespaceLoc,
                                            SourceLocation AliasLoc,
                                            IdentifierInfo *Alias,
-                                           const CXXScopeSpec &SS,
+                                           CXXScopeSpec &SS,
                                            SourceLocation IdentLoc,
                                            IdentifierInfo *Ident);
 
@@ -2040,7 +2040,7 @@
 
   NamedDecl *BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
                                    SourceLocation UsingLoc,
-                                   const CXXScopeSpec &SS,
+                                   CXXScopeSpec &SS,
                                    SourceLocation IdentLoc,
                                    DeclarationName Name,
                                    AttributeList *AttrList,
@@ -2052,7 +2052,7 @@
                                           AccessSpecifier AS,
                                           bool HasUsingKeyword,
                                           SourceLocation UsingLoc,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           UnqualifiedId &Name,
                                           AttributeList *AttrList,
                                           bool IsTypeName,
@@ -2153,7 +2153,7 @@
     
   virtual TypeTy *getDestructorName(SourceLocation TildeLoc,
                                     IdentifierInfo &II, SourceLocation NameLoc,
-                                    Scope *S, const CXXScopeSpec &SS,
+                                    Scope *S, CXXScopeSpec &SS,
                                     TypeTy *ObjectType,
                                     bool EnteringContext);
 
@@ -2287,7 +2287,7 @@
   virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
                                                      SourceLocation OpLoc,
                                                      tok::TokenKind OpKind,
-                                                     const CXXScopeSpec &SS,
+                                                     CXXScopeSpec &SS,
                                                    UnqualifiedId &FirstTypeName,
                                                      SourceLocation CCLoc,
                                                      SourceLocation TildeLoc,
@@ -2303,7 +2303,8 @@
   
   virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr);
 
-  bool RequireCompleteDeclContext(const CXXScopeSpec &SS);
+  // Marks SS invalid if it represents an incomplete type.
+  bool RequireCompleteDeclContext(CXXScopeSpec &SS);
 
   DeclContext *computeDeclContext(QualType T);
   DeclContext *computeDeclContext(const CXXScopeSpec &SS,
@@ -2320,13 +2321,13 @@
   bool isAcceptableNestedNameSpecifier(NamedDecl *SD);
   NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS);
 
-  virtual bool isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS,
+  virtual bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
                                             SourceLocation IdLoc,
                                             IdentifierInfo &II,
                                             TypeTy *ObjectType);
   
   CXXScopeTy *BuildCXXNestedNameSpecifier(Scope *S,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           SourceLocation IdLoc,
                                           SourceLocation CCLoc,
                                           IdentifierInfo &II,
@@ -2336,7 +2337,7 @@
                                           bool ErrorRecoveryLookup);
 
   virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S,
-                                                  const CXXScopeSpec &SS,
+                                                  CXXScopeSpec &SS,
                                                   SourceLocation IdLoc,
                                                   SourceLocation CCLoc,
                                                   IdentifierInfo &II,
@@ -2344,7 +2345,7 @@
                                                   bool EnteringContext);
 
   virtual bool IsInvalidUnlessNestedName(Scope *S,
-                                         const CXXScopeSpec &SS,
+                                         CXXScopeSpec &SS,
                                          IdentifierInfo &II,
                                          TypeTy *ObjectType,
                                          bool EnteringContext);
@@ -2371,7 +2372,7 @@
   /// looked up in the declarator-id's scope, until the declarator is parsed and
   /// ActOnCXXExitDeclaratorScope is called.
   /// The 'SS' should be a non-empty valid CXXScopeSpec.
-  virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
+  virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS);
 
   /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
   /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
@@ -2452,7 +2453,7 @@
 
   virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorD,
                                             Scope *S,
-                                            const CXXScopeSpec &SS,
+                                            CXXScopeSpec &SS,
                                             IdentifierInfo *MemberOrBase,
                                             TypeTy *TemplateTypeTy,
                                             SourceLocation IdLoc,
@@ -2690,11 +2691,11 @@
   //===--------------------------------------------------------------------===//
   // C++ Templates [C++ 14]
   //
-  void LookupTemplateName(LookupResult &R, Scope *S, const CXXScopeSpec &SS,
+  void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS,
                           QualType ObjectType, bool EnteringContext);
 
   virtual TemplateNameKind isTemplateName(Scope *S,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           UnqualifiedId &Name,
                                           TypeTy *ObjectType,
                                           bool EnteringContext,
@@ -2767,7 +2768,7 @@
                                           bool &IsExplicitSpecialization);
 
   DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                                SourceLocation KWLoc, const CXXScopeSpec &SS,
+                                SourceLocation KWLoc, CXXScopeSpec &SS,
                                 IdentifierInfo *Name, SourceLocation NameLoc,
                                 AttributeList *Attr,
                                 TemplateParameterList *TemplateParams,
@@ -2795,13 +2796,13 @@
                                        LookupResult &R,
                                        bool RequiresADL,
                                const TemplateArgumentListInfo &TemplateArgs);
-  OwningExprResult BuildQualifiedTemplateIdExpr(const CXXScopeSpec &SS,
+  OwningExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
                                                 DeclarationName Name,
                                                 SourceLocation NameLoc,
                                const TemplateArgumentListInfo &TemplateArgs);
 
   virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
-                                                const CXXScopeSpec &SS,
+                                                CXXScopeSpec &SS,
                                                 UnqualifiedId &Name,
                                                 TypeTy *ObjectType,
                                                 bool EnteringContext);
@@ -2814,7 +2815,7 @@
   virtual DeclResult
   ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
                                    SourceLocation KWLoc,
-                                   const CXXScopeSpec &SS,
+                                   CXXScopeSpec &SS,
                                    TemplateTy Template,
                                    SourceLocation TemplateNameLoc,
                                    SourceLocation LAngleLoc,
@@ -2868,7 +2869,7 @@
                              SourceLocation TemplateLoc,
                              unsigned TagSpec,
                              SourceLocation KWLoc,
-                             const CXXScopeSpec &SS,
+                             CXXScopeSpec &SS,
                              IdentifierInfo *Name,
                              SourceLocation NameLoc,
                              AttributeList *Attr);
@@ -4265,7 +4266,7 @@
   virtual void CodeCompleteCase(Scope *S);
   virtual void CodeCompleteCall(Scope *S, ExprTy *Fn,
                                 ExprTy **Args, unsigned NumArgs);
-  virtual void CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
+  virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
                                        bool EnteringContext);
   virtual void CodeCompleteUsing(Scope *S);
   virtual void CodeCompleteUsingDirective(Scope *S);

Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Thu Apr  8 11:38:48 2010
@@ -230,7 +230,7 @@
 /// that is currently being defined. Or, if we have a type that names
 /// a class template specialization that is not a complete type, we
 /// will attempt to instantiate that class template.
-bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) {
+bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS) {
   if (!SS.isSet() || SS.isInvalid())
     return false;
 
@@ -247,10 +247,13 @@
       return false;
 
     // The type must be complete.
-    return RequireCompleteType(SS.getRange().getBegin(),
-                               Context.getTypeDeclType(Tag),
-                               PDiag(diag::err_incomplete_nested_name_spec)
-                                 << SS.getRange());
+    if (RequireCompleteType(SS.getRange().getBegin(),
+                            Context.getTypeDeclType(Tag),
+                            PDiag(diag::err_incomplete_nested_name_spec)
+                            << SS.getRange())) {
+      SS.setScopeRep(0);  // Mark the ScopeSpec invalid.
+      return true;
+    }
   }
 
   return false;
@@ -322,7 +325,7 @@
   return 0;
 }
 
-bool Sema::isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS,
+bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
                                         SourceLocation IdLoc,
                                         IdentifierInfo &II,
                                         TypeTy *ObjectTypePtr) {
@@ -384,7 +387,7 @@
 /// scope if it *knows* that the result is correct.  It should not return in a
 /// dependent context, for example.
 Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S,
-                                                    const CXXScopeSpec &SS,
+                                                    CXXScopeSpec &SS,
                                                     SourceLocation IdLoc,
                                                     SourceLocation CCLoc,
                                                     IdentifierInfo &II,
@@ -593,7 +596,7 @@
 /// 'CCLoc' is the location of '::' and 'II' is the identifier for 'bar'.
 /// Returns a CXXScopeTy* object representing the C++ scope.
 Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S,
-                                                    const CXXScopeSpec &SS,
+                                                    CXXScopeSpec &SS,
                                                     SourceLocation IdLoc,
                                                     SourceLocation CCLoc,
                                                     IdentifierInfo &II,
@@ -611,7 +614,7 @@
 /// conservatively correct to always return false from this method.
 ///
 /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier.
-bool Sema::IsInvalidUnlessNestedName(Scope *S, const CXXScopeSpec &SS,
+bool Sema::IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS,
                                      IdentifierInfo &II, TypeTy *ObjectType,
                                      bool EnteringContext) {
   return BuildCXXNestedNameSpecifier(S, SS, SourceLocation(), SourceLocation(),
@@ -676,7 +679,7 @@
 /// looked up in the declarator-id's scope, until the declarator is parsed and
 /// ActOnCXXExitDeclaratorScope is called.
 /// The 'SS' should be a non-empty valid CXXScopeSpec.
-bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
+bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) {
   assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
 
   if (SS.isInvalid()) return true;

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu Apr  8 11:38:48 2010
@@ -2266,7 +2266,7 @@
                                              Results.size());
 }
 
-void Sema::CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
+void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
                                    bool EnteringContext) {
   if (!SS.getScopeRep() || !CodeCompleter)
     return;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr  8 11:38:48 2010
@@ -61,7 +61,7 @@
 /// If name lookup results in an ambiguity, this routine will complain
 /// and then return NULL.
 Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
-                                Scope *S, const CXXScopeSpec *SS,
+                                Scope *S, CXXScopeSpec *SS,
                                 bool isClassName,
                                 TypeTy *ObjectTypePtr) {
   // Determine where we will perform name lookup.
@@ -236,7 +236,7 @@
 bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, 
                                    SourceLocation IILoc,
                                    Scope *S,
-                                   const CXXScopeSpec *SS,
+                                   CXXScopeSpec *SS,
                                    TypeTy *&SuggestedType) {
   // We don't have anything to suggest (yet).
   SuggestedType = 0;
@@ -4707,7 +4707,7 @@
 /// TagSpec indicates what kind of tag this is. TUK indicates whether this is a
 /// reference/declaration/definition of a tag.
 Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                               SourceLocation KWLoc, const CXXScopeSpec &SS,
+                               SourceLocation KWLoc, CXXScopeSpec &SS,
                                IdentifierInfo *Name, SourceLocation NameLoc,
                                AttributeList *Attr, AccessSpecifier AS,
                                MultiTemplateParamsArg TemplateParameterLists,

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Apr  8 11:38:48 2010
@@ -1013,7 +1013,7 @@
 Sema::MemInitResult
 Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
                           Scope *S,
-                          const CXXScopeSpec &SS,
+                          CXXScopeSpec &SS,
                           IdentifierInfo *MemberOrBase,
                           TypeTy *TemplateTypeTy,
                           SourceLocation IdLoc,
@@ -3013,7 +3013,7 @@
 Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S,
                                           SourceLocation UsingLoc,
                                           SourceLocation NamespcLoc,
-                                          const CXXScopeSpec &SS,
+                                          CXXScopeSpec &SS,
                                           SourceLocation IdentLoc,
                                           IdentifierInfo *NamespcName,
                                           AttributeList *AttrList) {
@@ -3082,7 +3082,7 @@
                                             AccessSpecifier AS,
                                             bool HasUsingKeyword,
                                             SourceLocation UsingLoc,
-                                            const CXXScopeSpec &SS,
+                                            CXXScopeSpec &SS,
                                             UnqualifiedId &Name,
                                             AttributeList *AttrList,
                                             bool IsTypeName,
@@ -3363,7 +3363,7 @@
 ///   the lookup differently for these declarations.
 NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
                                        SourceLocation UsingLoc,
-                                       const CXXScopeSpec &SS,
+                                       CXXScopeSpec &SS,
                                        SourceLocation IdentLoc,
                                        DeclarationName Name,
                                        AttributeList *AttrList,
@@ -3700,7 +3700,7 @@
                                              SourceLocation NamespaceLoc,
                                              SourceLocation AliasLoc,
                                              IdentifierInfo *Alias,
-                                             const CXXScopeSpec &SS,
+                                             CXXScopeSpec &SS,
                                              SourceLocation IdentLoc,
                                              IdentifierInfo *Ident) {
 

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Apr  8 11:38:48 2010
@@ -895,7 +895,7 @@
 /// Diagnose an empty lookup.
 ///
 /// \return false if new lookup candidates were found
-bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS,
+bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS,
                                LookupResult &R) {
   DeclarationName Name = R.getLookupName();
 
@@ -1001,7 +1001,7 @@
 }
 
 Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
-                                               const CXXScopeSpec &SS,
+                                               CXXScopeSpec &SS,
                                                UnqualifiedId &Id,
                                                bool HasTrailingLParen,
                                                bool isAddressOfOperand) {
@@ -1200,7 +1200,7 @@
 /// There's a large number of things which don't need to be done along
 /// this path.
 Sema::OwningExprResult
-Sema::BuildQualifiedDeclarationNameExpr(const CXXScopeSpec &SS,
+Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
                                         DeclarationName Name,
                                         SourceLocation NameLoc) {
   DeclContext *DC;
@@ -2549,7 +2549,7 @@
 static bool
 LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
                          SourceRange BaseRange, const RecordType *RTy,
-                         SourceLocation OpLoc, const CXXScopeSpec &SS) {
+                         SourceLocation OpLoc, CXXScopeSpec &SS) {
   RecordDecl *RDecl = RTy->getDecl();
   if (SemaRef.RequireCompleteType(OpLoc, QualType(RTy, 0),
                               SemaRef.PDiag(diag::err_typecheck_incomplete_tag)
@@ -2606,7 +2606,7 @@
 Sema::OwningExprResult
 Sema::BuildMemberReferenceExpr(ExprArg BaseArg, QualType BaseType,
                                SourceLocation OpLoc, bool IsArrow,
-                               const CXXScopeSpec &SS,
+                               CXXScopeSpec &SS,
                                NamedDecl *FirstQualifierInScope,
                                DeclarationName Name, SourceLocation NameLoc,
                                const TemplateArgumentListInfo *TemplateArgs) {
@@ -2841,7 +2841,7 @@
 Sema::OwningExprResult
 Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
                        bool &IsArrow, SourceLocation OpLoc,
-                       const CXXScopeSpec &SS,
+                       CXXScopeSpec &SS,
                        DeclPtrTy ObjCImpDecl) {
   assert(BaseExpr && "no base expression");
 
@@ -3279,7 +3279,7 @@
 Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, ExprArg BaseArg,
                                                    SourceLocation OpLoc,
                                                    tok::TokenKind OpKind,
-                                                   const CXXScopeSpec &SS,
+                                                   CXXScopeSpec &SS,
                                                    UnqualifiedId &Id,
                                                    DeclPtrTy ObjCImpDecl,
                                                    bool HasTrailingLParen) {

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Apr  8 11:38:48 2010
@@ -29,7 +29,7 @@
 Action::TypeTy *Sema::getDestructorName(SourceLocation TildeLoc,
                                         IdentifierInfo &II, 
                                         SourceLocation NameLoc,
-                                        Scope *S, const CXXScopeSpec &SS,
+                                        Scope *S, CXXScopeSpec &SS,
                                         TypeTy *ObjectTypePtr,
                                         bool EnteringContext) {
   // Determine where to perform name lookup.
@@ -2705,7 +2705,7 @@
 Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
                                                        SourceLocation OpLoc,
                                                        tok::TokenKind OpKind,
-                                                       const CXXScopeSpec &SS,
+                                                       CXXScopeSpec &SS,
                                                   UnqualifiedId &FirstTypeName,
                                                        SourceLocation CCLoc,
                                                        SourceLocation TildeLoc,

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Apr  8 11:38:48 2010
@@ -1291,7 +1291,7 @@
 /// context of the scope-specifier SS (if present).
 ///
 /// @returns True if any decls were found (but possibly ambiguous)
-bool Sema::LookupParsedName(LookupResult &R, Scope *S, const CXXScopeSpec *SS,
+bool Sema::LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
                             bool AllowBuiltinCreation, bool EnteringContext) {
   if (SS && SS->isInvalid()) {
     // When the scope specifier is invalid, don't even look for
@@ -2500,7 +2500,7 @@
 /// \returns true if the typo was corrected, in which case the \p Res
 /// structure will contain the results of name lookup for the
 /// corrected name. Otherwise, returns false.
-bool Sema::CorrectTypo(LookupResult &Res, Scope *S, const CXXScopeSpec *SS,
+bool Sema::CorrectTypo(LookupResult &Res, Scope *S, CXXScopeSpec *SS,
                        DeclContext *MemberContext, bool EnteringContext,
                        const ObjCObjectPointerType *OPT) {
   if (Diags.hasFatalErrorOccurred())

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Apr  8 11:38:48 2010
@@ -76,7 +76,7 @@
 }
 
 TemplateNameKind Sema::isTemplateName(Scope *S,
-                                      const CXXScopeSpec &SS,
+                                      CXXScopeSpec &SS,
                                       UnqualifiedId &Name,
                                       TypeTy *ObjectTypePtr,
                                       bool EnteringContext,
@@ -169,7 +169,7 @@
 }
 
 void Sema::LookupTemplateName(LookupResult &Found,
-                              Scope *S, const CXXScopeSpec &SS,
+                              Scope *S, CXXScopeSpec &SS,
                               QualType ObjectType,
                               bool EnteringContext) {
   // Determine where to perform name lookup
@@ -705,7 +705,7 @@
 
 Sema::DeclResult
 Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
-                         SourceLocation KWLoc, const CXXScopeSpec &SS,
+                         SourceLocation KWLoc, CXXScopeSpec &SS,
                          IdentifierInfo *Name, SourceLocation NameLoc,
                          AttributeList *Attr,
                          TemplateParameterList *TemplateParams,
@@ -1545,7 +1545,7 @@
 
 // We actually only call this from template instantiation.
 Sema::OwningExprResult
-Sema::BuildQualifiedTemplateIdExpr(const CXXScopeSpec &SS,
+Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
                                    DeclarationName Name,
                                    SourceLocation NameLoc,
                              const TemplateArgumentListInfo &TemplateArgs) {
@@ -1586,7 +1586,7 @@
 /// of the "template" keyword, and "apply" is the \p Name.
 Sema::TemplateTy
 Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
-                                 const CXXScopeSpec &SS,
+                                 CXXScopeSpec &SS,
                                  UnqualifiedId &Name,
                                  TypeTy *ObjectType,
                                  bool EnteringContext) {
@@ -3482,7 +3482,7 @@
 Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
                                        TagUseKind TUK,
                                        SourceLocation KWLoc,
-                                       const CXXScopeSpec &SS,
+                                       CXXScopeSpec &SS,
                                        TemplateTy TemplateD,
                                        SourceLocation TemplateNameLoc,
                                        SourceLocation LAngleLoc,
@@ -4663,7 +4663,7 @@
                                  SourceLocation TemplateLoc,
                                  unsigned TagSpec,
                                  SourceLocation KWLoc,
-                                 const CXXScopeSpec &SS,
+                                 CXXScopeSpec &SS,
                                  IdentifierInfo *Name,
                                  SourceLocation NameLoc,
                                  AttributeList *Attr) {

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p3.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p3.cpp Thu Apr  8 11:38:48 2010
@@ -8,12 +8,11 @@
 // A definition of the class or class template containing a member function 
 // template shall be in scope at the point of the explicit instantiation of 
 // the member function template.
-struct X0; // expected-note 3{{forward declaration}}
-template<typename> struct X1; // expected-note 8{{declared here}}
+struct X0; // expected-note {{forward declaration}}
+template<typename> struct X1; // expected-note 5{{declared here}}
 
-// FIXME: Repeated diagnostics here!
-template void X0::f0<int>(int); // expected-error 3{{incomplete type}} // expected-error{{invalid token after top level declarator}}
-template void X1<int>::f0<int>(int); // expected-error 3{{implicit instantiation of undefined template}} // expected-error{{invalid token after top level declarator}}
+template void X0::f0<int>(int); // expected-error {{incomplete type}}
+template void X1<int>::f0<int>(int); // expected-error {{implicit instantiation of undefined template}}
 
 // A definition of a class template or class member template shall be in scope 
 // at the point of the explicit instantiation of the class template or class 
@@ -33,11 +32,10 @@
 // A definition of a class template shall be in scope at the point of an 
 // explicit instantiation of a member function or a static data member of the
 // class template.
-template void X1<int>::f1(int); // expected-error 2{{undefined template}} \
-                                // expected-error{{does not refer}}
+template void X1<int>::f1(int); // expected-error {{undefined template}}
+template void X1<int>::f1<int>(int); // expected-error {{undefined template}}
 
-template int X1<int>::member; // expected-error 2{{undefined template}} \
-                              // expected-error{{does not refer}}
+template int X1<int>::member; // expected-error {{undefined template}}
 
 // A definition of a member class of a class template shall be in scope at the 
 // point of an explicit instantiation of the member class.

Modified: cfe/trunk/test/SemaCXX/nested-name-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nested-name-spec.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nested-name-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/nested-name-spec.cpp Thu Apr  8 11:38:48 2010
@@ -165,8 +165,7 @@
 void N::f() { } // okay
 
 struct Y;  // expected-note{{forward declaration of 'Y'}}
-Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \
-         // expected-error{{no type named 'foo' in}}
+Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}}
 
 X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
       // expected-error{{C++ requires a type specifier for all declarations}} \
@@ -224,9 +223,8 @@
 
 // PR6259, invalid case
 namespace test3 {
-  // FIXME: this should really only trigger once
-  class A; // expected-note 2 {{forward declaration}}
+  class A; // expected-note {{forward declaration}}
   void foo(const char *path) {
-    A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}}
+    A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}}
   }
 }

Modified: cfe/trunk/test/SemaTemplate/instantiate-function-params.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-function-params.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-function-params.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-function-params.cpp Thu Apr  8 11:38:48 2010
@@ -29,8 +29,7 @@
   typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}}
 
 };
-typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \
-// expected-note 6{{in instantiation}}
+typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX;// expected-note 6{{in instantiation}}
 
 template<typename T> struct X0 { };
 template<typename R, typename A1> struct X0<R(A1 param)> { };

Modified: cfe/trunk/test/SemaTemplate/instantiate-typedef.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-typedef.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-typedef.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-typedef.cpp Thu Apr  8 11:38:48 2010
@@ -11,6 +11,5 @@
   return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}
 }
 
-add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} \
-// expected-error {{no type named 'type' in 'add_pointer<int &>'}}
+add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}}
 test3(); 

Modified: cfe/trunk/test/SemaTemplate/typename-specifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/typename-specifier.cpp?rev=100779&r1=100778&r2=100779&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/typename-specifier.cpp (original)
+++ cfe/trunk/test/SemaTemplate/typename-specifier.cpp Thu Apr  8 11:38:48 2010
@@ -42,13 +42,10 @@
 }
 
 N::X<N::A>::type *ip4 = &i;
-N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}} \
-// expected-error{{no type named 'type' in}}
-N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}} \
-// expected-error{{no type named 'type' in}}
+N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}}
+N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}}
 
-N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}} \
-// expected-error{{no type named 'type' in}}
+N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}}
 
 template<typename T>
 struct Y {
@@ -69,7 +66,5 @@
 };
 
 ::Y<A>::type ip7 = &i;
-::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}} \
-// expected-error{{no type named 'type' in}}
-::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}} \
-// expected-error{{no type named 'type' in}}
+::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}}
+::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}}





More information about the cfe-commits mailing list