[cfe-commits] r61637 - /cfe/trunk/lib/Parse/ParseExprCXX.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 4 13:14:15 PST 2009
Author: lattner
Date: Sun Jan 4 15:14:15 2009
New Revision: 61637
URL: http://llvm.org/viewvc/llvm-project?rev=61637&view=rev
Log:
minor simplifications.
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Jan 4 15:14:15 2009
@@ -33,28 +33,28 @@
assert(getLang().CPlusPlus &&
"Call sites of this function should be guarded by checking for C++.");
- if (Tok.isNot(tok::coloncolon) &&
- Tok.isNot(tok::annot_cxxscope) &&
- (Tok.isNot(tok::identifier) || NextToken().isNot(tok::coloncolon)))
- return false;
-
- // ::new and ::delete aren't nested-name-specifiers, so parsing the :: as
- // a scope specifier only makes things more complicated.
- if (Tok.is(tok::coloncolon) && (NextToken().is(tok::kw_new) ||
- NextToken().is(tok::kw_delete)))
- return false;
-
if (Tok.is(tok::annot_cxxscope)) {
SS.setScopeRep(Tok.getAnnotationValue());
SS.setRange(Tok.getAnnotationRange());
ConsumeToken();
return true;
}
+
+ if (Tok.isNot(tok::coloncolon) &&
+ (Tok.isNot(tok::identifier) || NextToken().isNot(tok::coloncolon)))
+ return false;
+
+ // ::new and ::delete aren't nested-name-specifiers, so parsing the :: as
+ // a scope specifier only makes things more complicated.
+ if (Tok.is(tok::coloncolon)) {
+ Token Next = NextToken();
+ if (Next.is(tok::kw_new) || Next.is(tok::kw_delete))
+ return false;
+ }
SS.setBeginLoc(Tok.getLocation());
// '::'
-
if (Tok.is(tok::coloncolon)) {
// Global scope.
SourceLocation CCLoc = ConsumeToken();
@@ -67,18 +67,16 @@
// namespace-name '::'
// nested-name-specifier identifier '::'
// nested-name-specifier 'template'[opt] simple-template-id '::' [TODO]
-
while (Tok.is(tok::identifier) && NextToken().is(tok::coloncolon)) {
IdentifierInfo *II = Tok.getIdentifierInfo();
SourceLocation IdLoc = ConsumeToken();
- assert(Tok.is(tok::coloncolon) &&
- "NextToken() not working properly!");
+ assert(Tok.is(tok::coloncolon) && "NextToken() not working properly!");
SourceLocation CCLoc = ConsumeToken();
if (SS.isInvalid())
continue;
SS.setScopeRep(
- Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, *II) );
+ Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, *II));
SS.setEndLoc(CCLoc);
}
More information about the cfe-commits
mailing list