aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseTentative.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/ParseTentative.cpp')
-rw-r--r--lib/Parse/ParseTentative.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 02687a216c7d..eb6e93540566 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -270,7 +270,7 @@ bool Parser::isCXXConditionDeclaration() {
return TPR == TPResult::True();
}
- /// \brief Determine whether the next set of tokens contains a type-id.
+ /// \brief Determine whether the next set of tokens contains a type-id.
///
/// The context parameter states what context we're parsing right
/// now, which affects how this routine copes with the token
@@ -288,7 +288,7 @@ bool Parser::isCXXConditionDeclaration() {
/// type-specifier-seq abstract-declarator[opt]
///
bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
-
+
isAmbiguous = false;
// C++ 8.2p2:
@@ -409,7 +409,7 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract,
while (1) {
if (Tok.is(tok::coloncolon) || Tok.is(tok::identifier))
- TryAnnotateCXXScopeToken();
+ TryAnnotateCXXScopeToken(true);
if (Tok.is(tok::star) || Tok.is(tok::amp) || Tok.is(tok::caret) ||
(Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
@@ -427,8 +427,12 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract,
// direct-declarator:
// direct-abstract-declarator:
- if (Tok.is(tok::identifier) && mayHaveIdentifier) {
+ if ((Tok.is(tok::identifier) ||
+ (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::identifier))) &&
+ mayHaveIdentifier) {
// declarator-id
+ if (Tok.is(tok::annot_cxxscope))
+ ConsumeToken();
ConsumeToken();
} else if (Tok.is(tok::l_paren)) {
ConsumeParen();
@@ -597,14 +601,14 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
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.
if (TryAnnotateTypeOrScopeToken())
return isCXXDeclarationSpecifier();
// Otherwise, not a typename.
return TPResult::False();
-
+
// decl-specifier:
// storage-class-specifier
// type-specifier
@@ -650,7 +654,7 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw__Complex:
case tok::kw___attribute:
return TPResult::True();
-
+
// Microsoft
case tok::kw___declspec:
case tok::kw___cdecl:
@@ -681,6 +685,8 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw_char:
case tok::kw_wchar_t:
+ case tok::kw_char16_t:
+ case tok::kw_char32_t:
case tok::kw_bool:
case tok::kw_short:
case tok::kw_int:
@@ -752,7 +758,7 @@ Parser::TPResult Parser::TryParseDeclarationSpecifier() {
TryParseTypeofSpecifier();
else
ConsumeToken();
-
+
assert(Tok.is(tok::l_paren) && "Expected '('!");
return TPResult::Ambiguous();
}
@@ -874,7 +880,7 @@ Parser::TPResult Parser::TryParseParameterDeclarationClause() {
/// If TryParseFunctionDeclarator fully parsed the function declarator, it will
/// return TPResult::Ambiguous(), otherwise it will return either False() or
/// Error().
-///
+///
/// '(' parameter-declaration-clause ')' cv-qualifier-seq[opt]
/// exception-specification[opt]
///