aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseTentative.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-19 00:35:18 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-19 00:35:18 +0000
commitae03cb5a84d13c7a0d4b21865bd63aabd18120d2 (patch)
treedf8b6f36fe5b797911bc53c870c50f4bddda6a9c /lib/Parse/ParseTentative.cpp
parent27a9b72bf1e4fe9f1d3ee9a5db1b9d614b0ee01c (diff)
Teach TryAnnotateTypeOrScopeToken to deal with already-annotated
scope specifiers. Fix a tentative parsing bug that came up in LLVM. Incidentally fixes some random FIXMEs in an existing testcase. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTentative.cpp')
-rw-r--r--lib/Parse/ParseTentative.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index dabd065a97..f521bc3a7a 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -680,10 +680,10 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
// Otherwise, not a typename.
return TPResult::False();
- case tok::coloncolon: // ::foo::bar
- if (NextToken().is(tok::kw_new) || // ::new
- NextToken().is(tok::kw_delete)) // ::delete
- return TPResult::False();
+ case tok::coloncolon: // ::foo::bar
+ if (NextToken().is(tok::kw_new) || // ::new
+ NextToken().is(tok::kw_delete)) // ::delete
+ return TPResult::False();
// Annotate typenames and C++ scope specifiers. If we get one, just
// recurse to handle whatever we get.
@@ -750,6 +750,12 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw___forceinline:
return TPResult::True();
+ case tok::annot_cxxscope: // foo::bar or ::foo::bar, but already parsed
+ // We've already annotated a scope; try to annotate a type.
+ if (!(TryAnnotateTypeOrScopeToken() && Tok.is(tok::annot_typename)))
+ return TPResult::False();
+ // If that succeeded, fallthrough into the generic simple-type-id case.
+
// The ambiguity resides in a simple-type-specifier/typename-specifier
// followed by a '('. The '(' could either be the start of:
//