diff options
author | Saar Raz <saar@raz.email> | 2020-01-31 20:05:09 +0200 |
---|---|---|
committer | Saar Raz <saar@raz.email> | 2020-01-31 20:08:13 +0200 |
commit | b7ce85a130789d23c69156f4b899962458d1f05d (patch) | |
tree | 8fe9ac54392a50be00374273b057401f54406902 /clang/lib/Parse/ParseDecl.cpp | |
parent | 5702dadf6f574aa2a9dbfe1dfa44023cd37fc696 (diff) | |
download | llvm-b7ce85a130789d23c69156f4b899962458d1f05d.zip llvm-b7ce85a130789d23c69156f4b899962458d1f05d.tar.gz llvm-b7ce85a130789d23c69156f4b899962458d1f05d.tar.bz2 |
[Concepts] Fix isDeclarationSpecifier to detect type-constraints correctly
isDeclarationSpecifiers did not handle some cases of placeholder-type-specifiers with
type-constraints, causing parsing bugs in abbreviated constructor templates.
Add comprehensive handling of type-constraints to isDeclarationSpecifier.
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 871ca25..af6e105 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -5061,6 +5061,8 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { // recurse to handle whatever we get. if (TryAnnotateTypeOrScopeToken()) return true; + if (TryAnnotateTypeConstraint()) + return true; if (Tok.is(tok::identifier)) return false; @@ -5193,11 +5195,14 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { // placeholder-type-specifier case tok::annot_template_id: { - TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok); - return TemplateId->Kind == TNK_Concept_template && + return isTypeConstraintAnnotation() && (NextToken().is(tok::kw_auto) || NextToken().is(tok::kw_decltype)); } - + case tok::annot_cxxscope: + if (NextToken().is(tok::identifier) && TryAnnotateTypeConstraint()) + return true; + return isTypeConstraintAnnotation() && + GetLookAheadToken(2).isOneOf(tok::kw_auto, tok::kw_decltype); case tok::kw___declspec: case tok::kw___cdecl: case tok::kw___stdcall: |