[cfe-commits] r61668 - /cfe/trunk/lib/Parse/ParseExprCXX.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 4 18:07:19 PST 2009
Author: lattner
Date: Sun Jan 4 20:07:19 2009
New Revision: 61668
URL: http://llvm.org/viewvc/llvm-project?rev=61668&view=rev
Log:
simplify some code.
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=61668&r1=61667&r2=61668&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Jan 4 20:07:19 2009
@@ -45,11 +45,6 @@
ConsumeToken();
return true;
}
-
- if (GlobalQualifier == 0 &&
- Tok.isNot(tok::coloncolon) &&
- (Tok.isNot(tok::identifier) || NextToken().isNot(tok::coloncolon)))
- return false;
if (GlobalQualifier) {
// Pre-parsed '::'.
@@ -60,27 +55,27 @@
assert(Tok.isNot(tok::kw_new) && Tok.isNot(tok::kw_delete) &&
"Never called with preparsed :: qualifier and with new/delete");
- } else {
- SS.setBeginLoc(Tok.getLocation());
-
+ } else if (Tok.is(tok::coloncolon)) {
// '::' - Global scope qualifier.
- if (Tok.is(tok::coloncolon)) {
- SourceLocation CCLoc = ConsumeToken();
-
- // ::new and ::delete aren't nested-name-specifiers, and
- // MaybeParseCXXScopeSpecifier is never called in a context where one
- // could exist. This means that if we see it, we have a syntax error.
- if (Tok.is(tok::kw_new) || Tok.is(tok::kw_delete)) {
- Diag(Tok, diag::err_invalid_qualified_new_delete)
- << Tok.is(tok::kw_delete);
- SS.setBeginLoc(SourceLocation());
- return false;
- }
+ SourceLocation CCLoc = ConsumeToken();
- // Global scope.
- SS.setScopeRep(Actions.ActOnCXXGlobalScopeSpecifier(CurScope, CCLoc));
- SS.setEndLoc(CCLoc);
+ // ::new and ::delete aren't nested-name-specifiers, and
+ // MaybeParseCXXScopeSpecifier is never called in a context where one
+ // could exist. This means that if we see it, we have a syntax error.
+ if (Tok.is(tok::kw_new) || Tok.is(tok::kw_delete)) {
+ Diag(Tok, diag::err_invalid_qualified_new_delete)
+ << Tok.is(tok::kw_delete);
+ return false;
}
+
+ SS.setBeginLoc(CCLoc);
+ SS.setScopeRep(Actions.ActOnCXXGlobalScopeSpecifier(CurScope, CCLoc));
+ SS.setEndLoc(CCLoc);
+ } else if (Tok.is(tok::identifier) && NextToken().is(tok::coloncolon)) {
+ SS.setBeginLoc(Tok.getLocation());
+ } else {
+ // Not a CXXScopeSpecifier.
+ return false;
}
// nested-name-specifier:
More information about the cfe-commits
mailing list