aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-04 21:14:15 +0000
committerChris Lattner <sabre@nondot.org>2009-01-04 21:14:15 +0000
commite607e808c2b90724a2a6fd841e850f07de1f5b30 (patch)
tree2a3ac6d844be637e7d0aa9009c3993141d76d8d8 /lib/Parse/ParseExprCXX.cpp
parentb723f7520bcce5f13ccaae557c16a1e7133b6908 (diff)
minor simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r--lib/Parse/ParseExprCXX.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 5da39bae07..b0ce072a41 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -33,28 +33,28 @@ bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS) {
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 @@ bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS) {
// 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);
}