summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/DeclSpec.cpp80
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp2
-rw-r--r--clang/lib/Sema/SemaDecl.cpp12
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp11
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp10
-rw-r--r--clang/lib/Sema/SemaTemplateVariadic.cpp69
-rw-r--r--clang/lib/Sema/SemaType.cpp23
7 files changed, 101 insertions, 106 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index 460e7722c10..2fad5a18ba6 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -324,52 +324,51 @@ bool Declarator::isDeclarationOfFunction() const {
}
switch (DS.getTypeSpecType()) {
- case TypeSpecifierType::TST_atomic:
- case TypeSpecifierType::TST_auto:
- case TypeSpecifierType::TST_auto_type:
- case TypeSpecifierType::TST_bool:
- case TypeSpecifierType::TST_char:
- case TypeSpecifierType::TST_char16:
- case TypeSpecifierType::TST_char32:
- case TypeSpecifierType::TST_class:
- case TypeSpecifierType::TST_decimal128:
- case TypeSpecifierType::TST_decimal32:
- case TypeSpecifierType::TST_decimal64:
- case TypeSpecifierType::TST_double:
- case TypeSpecifierType::TST_Float16:
- case TypeSpecifierType::TST_float128:
- case TypeSpecifierType::TST_enum:
- case TypeSpecifierType::TST_error:
- case TypeSpecifierType::TST_float:
- case TypeSpecifierType::TST_half:
- case TypeSpecifierType::TST_int:
- case TypeSpecifierType::TST_int128:
- case TypeSpecifierType::TST_struct:
- case TypeSpecifierType::TST_interface:
- case TypeSpecifierType::TST_union:
- case TypeSpecifierType::TST_unknown_anytype:
- case TypeSpecifierType::TST_unspecified:
- case TypeSpecifierType::TST_void:
- case TypeSpecifierType::TST_wchar:
-#define GENERIC_IMAGE_TYPE(ImgType, Id) \
- case TypeSpecifierType::TST_##ImgType##_t:
+ case TST_atomic:
+ case TST_auto:
+ case TST_auto_type:
+ case TST_bool:
+ case TST_char:
+ case TST_char16:
+ case TST_char32:
+ case TST_class:
+ case TST_decimal128:
+ case TST_decimal32:
+ case TST_decimal64:
+ case TST_double:
+ case TST_Float16:
+ case TST_float128:
+ case TST_enum:
+ case TST_error:
+ case TST_float:
+ case TST_half:
+ case TST_int:
+ case TST_int128:
+ case TST_struct:
+ case TST_interface:
+ case TST_union:
+ case TST_unknown_anytype:
+ case TST_unspecified:
+ case TST_void:
+ case TST_wchar:
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
#include "clang/Basic/OpenCLImageTypes.def"
return false;
- case TypeSpecifierType::TST_decltype_auto:
+ case TST_decltype_auto:
// This must have an initializer, so can't be a function declaration,
// even if the initializer has function type.
return false;
- case TypeSpecifierType::TST_decltype:
- case TypeSpecifierType::TST_typeofExpr:
+ case TST_decltype:
+ case TST_typeofExpr:
if (Expr *E = DS.getRepAsExpr())
return E->getType()->isFunctionType();
return false;
- case TypeSpecifierType::TST_underlyingType:
- case TypeSpecifierType::TST_typename:
- case TypeSpecifierType::TST_typeofType: {
+ case TST_underlyingType:
+ case TST_typename:
+ case TST_typeofType: {
QualType QT = DS.getRepAsType().get();
if (QT.isNull())
return false;
@@ -499,8 +498,7 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T,
case DeclSpec::TST_unspecified: return "unspecified";
case DeclSpec::TST_void: return "void";
case DeclSpec::TST_char: return "char";
- case DeclSpec::TST_wchar:
- return Policy.MSWChar ? "__wchar_t" : "wchar_t";
+ case DeclSpec::TST_wchar: return Policy.MSWChar ? "__wchar_t" : "wchar_t";
case DeclSpec::TST_char16: return "char16_t";
case DeclSpec::TST_char32: return "char32_t";
case DeclSpec::TST_int: return "int";
@@ -972,9 +970,9 @@ bool DeclSpec::SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
}
void DeclSpec::SaveWrittenBuiltinSpecs() {
- writtenBS.Sign = static_cast<unsigned char>(getTypeSpecSign());
- writtenBS.Width = static_cast<unsigned char>(getTypeSpecWidth());
- writtenBS.Type = static_cast<unsigned char>(getTypeSpecType());
+ writtenBS.Sign = getTypeSpecSign();
+ writtenBS.Width = getTypeSpecWidth();
+ writtenBS.Type = getTypeSpecType();
// Search the list of attributes for the presence of a mode attribute.
writtenBS.ModeAttr = false;
AttributeList* attrs = getAttributes().getList();
@@ -1112,7 +1110,7 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
}
// Validate the width of the type.
- switch (static_cast<TypeSpecifierWidth>(TypeSpecWidth)) {
+ switch (TypeSpecWidth) {
case TSW_unspecified: break;
case TSW_short: // short int
case TSW_longlong: // long long int
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 2433cf2d970..2acc896d53d 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4088,7 +4088,7 @@ void Sema::CodeCompleteObjCClassPropertyRefExpr(Scope *S,
Results.data(), Results.size());
}
-void Sema::CodeCompleteTag(Scope *S, TypeSpecifierType TagSpec) {
+void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) {
if (!CodeCompleter)
return;
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index b5c990939c5..743f4bb5e82 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -12786,11 +12786,11 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
// class type (or enum type) for linkage purposes only.
// We need to check whether the type was declared in the declaration.
switch (D.getDeclSpec().getTypeSpecType()) {
- case TypeSpecifierType::TST_enum:
- case TypeSpecifierType::TST_struct:
- case TypeSpecifierType::TST_interface:
- case TypeSpecifierType::TST_union:
- case TypeSpecifierType::TST_class: {
+ case TST_enum:
+ case TST_struct:
+ case TST_interface:
+ case TST_union:
+ case TST_class: {
TagDecl *tagFromDeclSpec = cast<TagDecl>(D.getDeclSpec().getRepAsDecl());
setTagNameForLinkagePurposes(tagFromDeclSpec, NewTD);
break;
@@ -13074,7 +13074,7 @@ static bool isAcceptableTagRedeclContext(Sema &S, DeclContext *OldDC,
///
/// \param SkipBody If non-null, will be set to indicate if the caller should
/// skip the definition of this tag and treat it as if it were a declaration.
-Decl *Sema::ActOnTag(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK,
+Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
SourceLocation KWLoc, CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
AttributeList *Attr, AccessSpecifier AS,
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index ca108491943..ceded02e394 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -3775,9 +3775,9 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
if (TemplateTypeTy) {
BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo);
- } else if (DS.getTypeSpecType() == TypeSpecifierType::TST_decltype) {
+ } else if (DS.getTypeSpecType() == TST_decltype) {
BaseType = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
- } else if (DS.getTypeSpecType() == TypeSpecifierType::TST_decltype_auto) {
+ } else if (DS.getTypeSpecType() == TST_decltype_auto) {
Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid);
return true;
} else {
@@ -13480,10 +13480,11 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation LocStart,
/// Handle a friend tag declaration where the scope specifier was
/// templated.
Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
- TypeSpecifierType TagSpec,
- SourceLocation TagLoc, CXXScopeSpec &SS,
+ unsigned TagSpec, SourceLocation TagLoc,
+ CXXScopeSpec &SS,
IdentifierInfo *Name,
- SourceLocation NameLoc, AttributeList *Attr,
+ SourceLocation NameLoc,
+ AttributeList *Attr,
MultiTemplateParamsArg TempParamLists) {
TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec);
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 9cc19672eff..7c6af5793fc 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -1152,7 +1152,7 @@ static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) {
}
DeclResult
-Sema::CheckClassTemplate(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK,
+Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
SourceLocation KWLoc, CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
AttributeList *Attr,
@@ -7336,7 +7336,7 @@ bool Sema::CheckTemplatePartialSpecializationArgs(
}
DeclResult
-Sema::ActOnClassTemplateSpecialization(Scope *S, TypeSpecifierType TagSpec,
+Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
TagUseKind TUK,
SourceLocation KWLoc,
SourceLocation ModulePrivateLoc,
@@ -8506,7 +8506,7 @@ DeclResult
Sema::ActOnExplicitInstantiation(Scope *S,
SourceLocation ExternLoc,
SourceLocation TemplateLoc,
- TypeSpecifierType TagSpec,
+ unsigned TagSpec,
SourceLocation KWLoc,
const CXXScopeSpec &SS,
TemplateTy TemplateD,
@@ -8794,7 +8794,7 @@ DeclResult
Sema::ActOnExplicitInstantiation(Scope *S,
SourceLocation ExternLoc,
SourceLocation TemplateLoc,
- TypeSpecifierType TagSpec,
+ unsigned TagSpec,
SourceLocation KWLoc,
CXXScopeSpec &SS,
IdentifierInfo *Name,
@@ -9310,7 +9310,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
}
TypeResult
-Sema::ActOnDependentTag(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK,
+Sema::ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
const CXXScopeSpec &SS, IdentifierInfo *Name,
SourceLocation TagLoc, SourceLocation NameLoc) {
// This has to hold, because SS is expected to be defined.
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp
index 7acdad5572f..d81837dad50 100644
--- a/clang/lib/Sema/SemaTemplateVariadic.cpp
+++ b/clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -791,53 +791,52 @@ Optional<unsigned> Sema::getNumArgumentsInExpansion(QualType T,
bool Sema::containsUnexpandedParameterPacks(Declarator &D) {
const DeclSpec &DS = D.getDeclSpec();
switch (DS.getTypeSpecType()) {
- case TypeSpecifierType::TST_typename:
- case TypeSpecifierType::TST_typeofType:
- case TypeSpecifierType::TST_underlyingType:
- case TypeSpecifierType::TST_atomic: {
+ case TST_typename:
+ case TST_typeofType:
+ case TST_underlyingType:
+ case TST_atomic: {
QualType T = DS.getRepAsType().get();
if (!T.isNull() && T->containsUnexpandedParameterPack())
return true;
break;
}
- case TypeSpecifierType::TST_typeofExpr:
- case TypeSpecifierType::TST_decltype:
+ case TST_typeofExpr:
+ case TST_decltype:
if (DS.getRepAsExpr() &&
DS.getRepAsExpr()->containsUnexpandedParameterPack())
return true;
break;
- case TypeSpecifierType::TST_unspecified:
- case TypeSpecifierType::TST_void:
- case TypeSpecifierType::TST_char:
- case TypeSpecifierType::TST_wchar:
- case TypeSpecifierType::TST_char16:
- case TypeSpecifierType::TST_char32:
- case TypeSpecifierType::TST_int:
- case TypeSpecifierType::TST_int128:
- case TypeSpecifierType::TST_half:
- case TypeSpecifierType::TST_float:
- case TypeSpecifierType::TST_double:
- case TypeSpecifierType::TST_Float16:
- case TypeSpecifierType::TST_float128:
- case TypeSpecifierType::TST_bool:
- case TypeSpecifierType::TST_decimal32:
- case TypeSpecifierType::TST_decimal64:
- case TypeSpecifierType::TST_decimal128:
- case TypeSpecifierType::TST_enum:
- case TypeSpecifierType::TST_union:
- case TypeSpecifierType::TST_struct:
- case TypeSpecifierType::TST_interface:
- case TypeSpecifierType::TST_class:
- case TypeSpecifierType::TST_auto:
- case TypeSpecifierType::TST_auto_type:
- case TypeSpecifierType::TST_decltype_auto:
-#define GENERIC_IMAGE_TYPE(ImgType, Id) \
- case TypeSpecifierType::TST_##ImgType##_t:
+ case TST_unspecified:
+ case TST_void:
+ case TST_char:
+ case TST_wchar:
+ case TST_char16:
+ case TST_char32:
+ case TST_int:
+ case TST_int128:
+ case TST_half:
+ case TST_float:
+ case TST_double:
+ case TST_Float16:
+ case TST_float128:
+ case TST_bool:
+ case TST_decimal32:
+ case TST_decimal64:
+ case TST_decimal128:
+ case TST_enum:
+ case TST_union:
+ case TST_struct:
+ case TST_interface:
+ case TST_class:
+ case TST_auto:
+ case TST_auto_type:
+ case TST_decltype_auto:
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
#include "clang/Basic/OpenCLImageTypes.def"
- case TypeSpecifierType::TST_unknown_anytype:
- case TypeSpecifierType::TST_error:
+ case TST_unknown_anytype:
+ case TST_error:
break;
}
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 2cab63f1d3e..4dab52a9f5f 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1433,10 +1433,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
// If the type is deprecated or unavailable, diagnose it.
S.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeNameLoc());
- assert(DS.getTypeSpecWidth() == TypeSpecifierWidth::TSW_unspecified &&
- DS.getTypeSpecComplex() == 0 &&
- DS.getTypeSpecSign() == TypeSpecifierSign::TSS_unspecified &&
- "No qualifiers on tag names!");
+ assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
+ DS.getTypeSpecSign() == 0 && "No qualifiers on tag names!");
// TypeQuals handled by caller.
Result = Context.getTypeDeclType(D);
@@ -1448,9 +1446,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
break;
}
case DeclSpec::TST_typename: {
- assert(DS.getTypeSpecWidth() == TypeSpecifierWidth::TSW_unspecified &&
- DS.getTypeSpecComplex() == 0 &&
- DS.getTypeSpecSign() == TypeSpecifierSign::TSS_unspecified &&
+ assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
+ DS.getTypeSpecSign() == 0 &&
"Can't handle qualifiers on typedef names yet!");
Result = S.GetTypeFromParser(DS.getRepAsType());
if (Result.isNull()) {
@@ -4986,7 +4983,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
TypeProcessingState state(*this, D);
TypeSourceInfo *ReturnTypeInfo = nullptr;
- QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
+ QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
if (D.isPrototypeContext() && getLangOpts().ObjCAutoRefCount)
inferARCWriteback(state, T);
@@ -5311,16 +5308,16 @@ namespace {
// Set info for the written builtin specifiers.
TL.getWrittenBuiltinSpecs() = DS.getWrittenBuiltinSpecs();
// Try to have a meaningful source location.
- if (TL.getWrittenSignSpec() != TypeSpecifierSign::TSS_unspecified)
+ if (TL.getWrittenSignSpec() != TSS_unspecified)
TL.expandBuiltinRange(DS.getTypeSpecSignLoc());
- if (TL.getWrittenWidthSpec() != TypeSpecifierWidth::TSW_unspecified)
+ if (TL.getWrittenWidthSpec() != TSW_unspecified)
TL.expandBuiltinRange(DS.getTypeSpecWidthRange());
}
}
void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
ElaboratedTypeKeyword Keyword
= TypeWithKeyword::getKeywordForTypeSpec(DS.getTypeSpecType());
- if (DS.getTypeSpecType() == TypeSpecifierType::TST_typename) {
+ if (DS.getTypeSpecType() == TST_typename) {
TypeSourceInfo *TInfo = nullptr;
Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
if (TInfo) {
@@ -5336,7 +5333,7 @@ namespace {
Visit(TL.getNextTypeLoc().getUnqualifiedLoc());
}
void VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
- assert(DS.getTypeSpecType() == TypeSpecifierType::TST_typename);
+ assert(DS.getTypeSpecType() == TST_typename);
TypeSourceInfo *TInfo = nullptr;
Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
assert(TInfo);
@@ -5344,7 +5341,7 @@ namespace {
}
void VisitDependentTemplateSpecializationTypeLoc(
DependentTemplateSpecializationTypeLoc TL) {
- assert(DS.getTypeSpecType() == TypeSpecifierType::TST_typename);
+ assert(DS.getTypeSpecType() == TST_typename);
TypeSourceInfo *TInfo = nullptr;
Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
assert(TInfo);
OpenPOWER on IntegriCloud