[cfe-commits] r91738 - /cfe/trunk/lib/Parse/ParseTentative.cpp

Chris Lattner sabre at nondot.org
Fri Dec 18 17:11:05 PST 2009


Author: lattner
Date: Fri Dec 18 19:11:05 2009
New Revision: 91738

URL: http://llvm.org/viewvc/llvm-project?rev=91738&view=rev
Log:
eliminate a call to NextToken() when parsing ::foo

Modified:
    cfe/trunk/lib/Parse/ParseTentative.cpp

Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=91738&r1=91737&r2=91738&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Fri Dec 18 19:11:05 2009
@@ -680,9 +680,10 @@
     // Otherwise, not a typename.
     return TPResult::False();
 
-  case tok::coloncolon:     // ::foo::bar
-    if (NextToken().is(tok::kw_new) ||    // ::new
-        NextToken().is(tok::kw_delete))   // ::delete
+  case tok::coloncolon: {    // ::foo::bar
+    const Token &Next = NextToken();
+    if (Next.is(tok::kw_new) ||    // ::new
+        Next.is(tok::kw_delete))   // ::delete
       return TPResult::False();
 
     // Annotate typenames and C++ scope specifiers.  If we get one, just
@@ -691,7 +692,8 @@
       return isCXXDeclarationSpecifier();
     // Otherwise, not a typename.
     return TPResult::False();
-
+  }
+      
     // decl-specifier:
     //   storage-class-specifier
     //   type-specifier
@@ -699,7 +701,6 @@
     //   'friend'
     //   'typedef'
     //   'constexpr'
-
   case tok::kw_friend:
   case tok::kw_typedef:
   case tok::kw_constexpr:





More information about the cfe-commits mailing list