[cfe-commits] r106536 - in /cfe/trunk: lib/Parse/ParseExprCXX.cpp test/Parser/cxx-undeclared-identifier.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Jun 22 04:30:04 PDT 2010


Author: akirtzidis
Date: Tue Jun 22 06:30:04 2010
New Revision: 106536

URL: http://llvm.org/viewvc/llvm-project?rev=106536&view=rev
Log:
Fix PR7180.

For

void f( a::b::c );

we would cache the tokens "a::b::" but then we would try to annotate them using the range "a::".
Before annotating them with the (invalid) C++ scope spec, set it to the range of "a::b::".

Modified:
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=106536&r1=106535&r2=106536&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Tue Jun 22 06:30:04 2010
@@ -278,12 +278,10 @@
         HasScopeSpecifier = true;
       }
 
-      if (SS.isInvalid())
-        continue;
-
-      SS.setScopeRep(
-        Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II,
-                                            ObjectType, EnteringContext));
+      if (!SS.isInvalid())
+        SS.setScopeRep(
+            Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II,
+                                                ObjectType, EnteringContext));
       SS.setEndLoc(CCLoc);
       continue;
     }

Modified: cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp?rev=106536&r1=106535&r2=106536&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp (original)
+++ cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp Tue Jun 22 06:30:04 2010
@@ -1,5 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
 
+// PR7180
+int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}}
+
 class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
                  // expected-note {{to match this '{'}} \
                  // expected-error {{expected ';' after class}}





More information about the cfe-commits mailing list