summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
diff options
context:
space:
mode:
authorFaisal Vali <faisalv@yahoo.com>2018-01-01 15:42:13 +0000
committerFaisal Vali <faisalv@yahoo.com>2018-01-01 15:42:13 +0000
commit038df490334d63f6533fa1fdf0b310f59e2d730b (patch)
tree7566cd5f09b5b4047759cbac8a8d912035873d67 /clang/lib/Parse
parent208ac6547c4f98c75e76a79f13a8d4f9d1076ab2 (diff)
downloadbcm5719-llvm-038df490334d63f6533fa1fdf0b310f59e2d730b.tar.gz
bcm5719-llvm-038df490334d63f6533fa1fdf0b310f59e2d730b.zip
[NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & TypeSpecifierType into scoped enums with underlying types.
- Since these enums are used as bit-fields - for the bit-fields to be interpreted as unsigned, the underlying type must be specified as unsigned. Previous failed attempt - wherein I did not specify an underlying type - was the sum of: https://reviews.llvm.org/rC321614 https://reviews.llvm.org/rC321615 llvm-svn: 321622
Diffstat (limited to 'clang/lib/Parse')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp10
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp26
-rw-r--r--clang/lib/Parse/ParseExpr.cpp9
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp2
-rw-r--r--clang/lib/Parse/ParseObjc.cpp5
-rw-r--r--clang/lib/Parse/Parser.cpp2
6 files changed, 30 insertions, 24 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 127e18439b8..37cb8e29ea5 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3139,7 +3139,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
// static const bool __is_signed;
//
// then treat __is_signed as an identifier rather than as a keyword.
- if (DS.getTypeSpecType() == TST_bool &&
+ if (DS.getTypeSpecType() == TypeSpecifierType::TST_bool &&
DS.getTypeQualifiers() == DeclSpec::TQ_const &&
DS.getStorageClassSpec() == DeclSpec::SCS_static)
TryKeywordIdentFallback(true);
@@ -3614,7 +3614,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
break;
#include "clang/Basic/OpenCLImageTypes.def"
case tok::kw___unknown_anytype:
- isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc,
+ isInvalid = DS.SetTypeSpecType(TypeSpecifierType::TST_unknown_anytype, Loc,
PrevSpec, DiagID, Policy);
break;
@@ -3888,7 +3888,7 @@ void Parser::ParseStructDeclaration(
/// [OBC] '@' 'defs' '(' class-name ')'
///
void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
- unsigned TagType, Decl *TagDecl) {
+ TypeSpecifierType TagType, Decl *TagDecl) {
PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
"parsing struct/union body");
assert(!getLangOpts().CPlusPlus && "C++ declarations not supported");
@@ -5527,7 +5527,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
NextToken().is(tok::r_paren) &&
!D.hasGroupingParens() &&
!Actions.containsUnexpandedParameterPacks(D) &&
- D.getDeclSpec().getTypeSpecType() != TST_auto)) {
+ D.getDeclSpec().getTypeSpecType() != TypeSpecifierType::TST_auto)) {
SourceLocation EllipsisLoc = ConsumeToken();
if (isPtrOperatorToken(Tok.getKind(), getLangOpts(), D.getContext())) {
// The ellipsis was put in the wrong place. Recover, and explain to
@@ -6107,7 +6107,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
LocalEndLoc = EndLoc;
if (getLangOpts().CPlusPlus11 && Tok.is(tok::arrow)) {
Diag(Tok, diag::warn_cxx98_compat_trailing_return_type);
- if (D.getDeclSpec().getTypeSpecType() == TST_auto)
+ if (D.getDeclSpec().getTypeSpecType() == TypeSpecifierType::TST_auto)
StartLoc = D.getDeclSpec().getTypeSpecTypeLoc();
LocalEndLoc = Tok.getLocation();
SourceRange Range;
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 68b73ca1d25..8953eef1d7e 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1011,10 +1011,12 @@ void Parser::AnnotateExistingDecltypeSpecifier(const DeclSpec& DS,
PP.EnterToken(Tok);
Tok.setKind(tok::annot_decltype);
- setExprAnnotation(Tok,
- DS.getTypeSpecType() == TST_decltype ? DS.getRepAsExpr() :
- DS.getTypeSpecType() == TST_decltype_auto ? ExprResult() :
- ExprError());
+ setExprAnnotation(Tok, DS.getTypeSpecType() == TypeSpecifierType::TST_decltype
+ ? DS.getRepAsExpr()
+ : DS.getTypeSpecType() ==
+ TypeSpecifierType::TST_decltype_auto
+ ? ExprResult()
+ : ExprError());
Tok.setAnnotationEndLoc(EndLoc);
Tok.setLocation(StartLoc);
PP.AnnotateCachedTokens(Tok);
@@ -1194,8 +1196,8 @@ TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc,
const char *PrevSpec = nullptr;
unsigned DiagID;
- DS.SetTypeSpecType(TST_typename, IdLoc, PrevSpec, DiagID, Type,
- Actions.getASTContext().getPrintingPolicy());
+ DS.SetTypeSpecType(TypeSpecifierType::TST_typename, IdLoc, PrevSpec, DiagID,
+ Type, Actions.getASTContext().getPrintingPolicy());
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext);
return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
@@ -2952,7 +2954,8 @@ ExprResult Parser::ParseCXXMemberInitializer(Decl *D, bool IsFunction,
void Parser::SkipCXXMemberSpecification(SourceLocation RecordLoc,
SourceLocation AttrFixitLoc,
- unsigned TagType, Decl *TagDecl) {
+ TypeSpecifierType TagType,
+ Decl *TagDecl) {
// Skip the optional 'final' keyword.
if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {
assert(isCXX11FinalKeyword() && "not a class definition");
@@ -3104,11 +3107,12 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclarationWithPragmas(
void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
SourceLocation AttrFixitLoc,
ParsedAttributesWithRange &Attrs,
- unsigned TagType, Decl *TagDecl) {
+ TypeSpecifierType TagType,
+ Decl *TagDecl) {
assert((TagType == DeclSpec::TST_struct ||
- TagType == DeclSpec::TST_interface ||
- TagType == DeclSpec::TST_union ||
- TagType == DeclSpec::TST_class) && "Invalid TagType!");
+ TagType == DeclSpec::TST_interface ||
+ TagType == DeclSpec::TST_union || TagType == DeclSpec::TST_class) &&
+ "Invalid TagType!");
PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
"parsing struct/union/class body");
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 1b8865edb79..057b4e6cd5b 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -997,9 +997,10 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
DS.SetRangeEnd(ILoc);
const char *PrevSpec = nullptr;
unsigned DiagID;
- DS.SetTypeSpecType(TST_typename, ILoc, PrevSpec, DiagID, Typ,
+ DS.SetTypeSpecType(TypeSpecifierType::TST_typename, ILoc, PrevSpec,
+ DiagID, Typ,
Actions.getASTContext().getPrintingPolicy());
-
+
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext);
TypeResult Ty = Actions.ActOnTypeName(getCurScope(),
DeclaratorInfo);
@@ -1205,8 +1206,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
const char *PrevSpec = nullptr;
unsigned DiagID;
- DS.SetTypeSpecType(TST_typename, Tok.getAnnotationEndLoc(),
- PrevSpec, DiagID, Type,
+ DS.SetTypeSpecType(TypeSpecifierType::TST_typename,
+ Tok.getAnnotationEndLoc(), PrevSpec, DiagID, Type,
Actions.getASTContext().getPrintingPolicy());
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext);
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 554ab24b02e..3e2f4fd5891 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -1551,7 +1551,7 @@ Parser::ParseCXXPseudoDestructor(Expr *Base, SourceLocation OpLoc,
if (Tok.is(tok::kw_decltype) && !FirstTypeName.isValid() && SS.isEmpty()) {
DeclSpec DS(AttrFactory);
ParseDecltypeSpecifier(DS);
- if (DS.getTypeSpecType() == TST_error)
+ if (DS.getTypeSpecType() == TypeSpecifierType::TST_error)
return ExprError();
return Actions.ActOnPseudoDestructorExpr(getCurScope(), Base, OpLoc, OpKind,
TildeLoc, DS);
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 688376ca28e..4a29ee1b9a4 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1699,8 +1699,9 @@ void Parser::parseObjCTypeArgsOrProtocolQualifiers(
DeclSpec DS(AttrFactory);
const char *prevSpec = nullptr;
unsigned diagID;
- DS.SetTypeSpecType(TST_typename, identifierLocs[i], prevSpec, diagID,
- typeArg, Actions.getASTContext().getPrintingPolicy());
+ DS.SetTypeSpecType(TypeSpecifierType::TST_typename, identifierLocs[i],
+ prevSpec, diagID, typeArg,
+ Actions.getASTContext().getPrintingPolicy());
// Form a declarator to turn this into a type.
Declarator D(DS, DeclaratorContext::TypeNameContext);
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index a6f966eda1b..9e33b3470dd 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -174,7 +174,7 @@ bool Parser::ExpectAndConsumeSemi(unsigned DiagID) {
return ExpectAndConsume(tok::semi, DiagID);
}
-void Parser::ConsumeExtraSemi(ExtraSemiKind Kind, unsigned TST) {
+void Parser::ConsumeExtraSemi(ExtraSemiKind Kind, TypeSpecifierType TST) {
if (!Tok.is(tok::semi)) return;
bool HadMultipleSemis = false;
OpenPOWER on IntegriCloud