Add better comments to ::new parsing. Thanks to Doug for the review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60423 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 50b3a7a..52caffb 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -639,6 +639,8 @@
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
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 5d790fa..c126b43 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -38,8 +38,8 @@
(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;