aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-02 17:10:24 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-02 17:10:24 +0000
commitbcf293bb63d1ce9f77ef8232432d979750d30b70 (patch)
treeebdbb8615a2bb37ee79d7231fba59c40cc1ccc63
parent500386194c73b7976894278a7da08ad9b59ec81e (diff)
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
-rw-r--r--lib/Parse/ParseExpr.cpp2
-rw-r--r--lib/Parse/ParseExprCXX.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 50b3a7a4ef..52caffbb7f 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -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
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 5d790fa34c..c126b433dd 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -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;