]> granicus.if.org Git - clang/commitdiff
Add better comments to ::new parsing. Thanks to Doug for the review.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Tue, 2 Dec 2008 17:10:24 +0000 (17:10 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Tue, 2 Dec 2008 17:10:24 +0000 (17:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60423 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
lib/Parse/ParseExprCXX.cpp

index 50b3a7a4ef9e3e5ac5c5914fa6e9993e0a927d9a..52caffbb7fc8500b1f185d5957fcef67ba6493aa 100644 (file)
@@ -639,6 +639,8 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
     return ParsePostfixExpressionSuffix(Res);
 
   case tok::coloncolon: // [C++] new-expression or [C++] delete-expression
+    // If the next token is neither 'new' nor 'delete', the :: would have been
+    // parsed as a scope specifier already.
     if (NextToken().is(tok::kw_new))
       return ParseCXXNewExpression();
     else
index 5d790fa34cdb9bd9b9fe3a5070721169d39bdc1f..c126b433dd7a4594c095e07f229a8aa83e671325 100644 (file)
@@ -38,8 +38,8 @@ bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS) {
       (Tok.isNot(tok::identifier) || NextToken().isNot(tok::coloncolon)))
     return false;
 
-  // Don't parse ::new and ::delete as scope specifiers. It would only make
-  // things a lot more complicated.
+  // ::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;