aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2020-04-17 10:44:19 -0700
committerErich Keane <erich.keane@intel.com>2020-04-17 10:45:48 -0700
commit5f0903e9bec97e67bf34d887bcbe9d05790de934 (patch)
treef0e7c27a17af3f8ec0837b02160012bfc4177025 /clang/lib/Parse/ParseDecl.cpp
parent5f6d93c7d3165938ed4602013f4b89929b1f9682 (diff)
downloadllvm-5f0903e9bec97e67bf34d887bcbe9d05790de934.zip
llvm-5f0903e9bec97e67bf34d887bcbe9d05790de934.tar.gz
llvm-5f0903e9bec97e67bf34d887bcbe9d05790de934.tar.bz2
Reland Implement _ExtInt as an extended int type specifier.
I fixed the LLDB issue, so re-applying the patch. This reverts commit a4b88c044980337bb14390be654fe76864aa60ec.
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 8bd7571..fe00199 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -2880,6 +2880,25 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs,
ParsedAttr::AS_Keyword, EllipsisLoc);
}
+ExprResult Parser::ParseExtIntegerArgument() {
+ assert(Tok.is(tok::kw__ExtInt) && "Not an extended int type");
+ ConsumeToken();
+
+ BalancedDelimiterTracker T(*this, tok::l_paren);
+ if (T.expectAndConsume())
+ return ExprError();
+
+ ExprResult ER = ParseConstantExpression();
+ if (ER.isInvalid()) {
+ T.skipToEnd();
+ return ExprError();
+ }
+
+ if(T.consumeClose())
+ return ExprError();
+ return ER;
+}
+
/// Determine whether we're looking at something that might be a declarator
/// in a simple-declaration. If it can't possibly be a declarator, maybe
/// diagnose a missing semicolon after a prior tag definition in the decl
@@ -3807,6 +3826,14 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_int, Loc, PrevSpec,
DiagID, Policy);
break;
+ case tok::kw__ExtInt: {
+ ExprResult ER = ParseExtIntegerArgument();
+ if (ER.isInvalid())
+ continue;
+ isInvalid = DS.SetExtIntType(Loc, ER.get(), PrevSpec, DiagID, Policy);
+ ConsumedEnd = PrevTokLocation;
+ break;
+ }
case tok::kw___int128:
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_int128, Loc, PrevSpec,
DiagID, Policy);
@@ -4890,6 +4917,7 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const {
case tok::kw_char16_t:
case tok::kw_char32_t:
case tok::kw_int:
+ case tok::kw__ExtInt:
case tok::kw_half:
case tok::kw_float:
case tok::kw_double:
@@ -4969,6 +4997,7 @@ bool Parser::isTypeSpecifierQualifier() {
case tok::kw_char16_t:
case tok::kw_char32_t:
case tok::kw_int:
+ case tok::kw__ExtInt:
case tok::kw_half:
case tok::kw_float:
case tok::kw_double:
@@ -5135,6 +5164,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
case tok::kw_char32_t:
case tok::kw_int:
+ case tok::kw__ExtInt:
case tok::kw_half:
case tok::kw_float:
case tok::kw_double: