30 assert(
TemplateId &&
"NULL template-id annotation?");
32 "should not convert invalid template-ids to unqualified-ids");
41 assert(
TemplateId &&
"NULL template-id annotation?");
43 "should not convert invalid template-ids to unqualified-ids");
53 Builder.Make(Context, TL, ColonColonLoc);
54 if (Range.getBegin().isInvalid())
56 Range.setEnd(ColonColonLoc);
58 assert(Range == Builder.getSourceRange() &&
59 "NestedNameSpecifierLoc range computation incorrect");
65 Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
67 if (Range.getBegin().isInvalid())
68 Range.setBegin(NamespaceLoc);
69 Range.setEnd(ColonColonLoc);
71 assert(Range == Builder.getSourceRange() &&
72 "NestedNameSpecifierLoc range computation incorrect");
77 Builder.MakeGlobal(Context, ColonColonLoc);
81 assert(Range == Builder.getSourceRange() &&
82 "NestedNameSpecifierLoc range computation incorrect");
88 Builder.MakeMicrosoftSuper(Context, RD, SuperLoc, ColonColonLoc);
90 Range.setBegin(SuperLoc);
91 Range.setEnd(ColonColonLoc);
93 assert(Range == Builder.getSourceRange() &&
94 "NestedNameSpecifierLoc range computation incorrect");
99 Builder.MakeTrivial(Context, Qualifier, R);
110 Range =
Other.getSourceRange();
111 Builder.Adopt(
Other);
112 assert(Range == Builder.getSourceRange() &&
113 "NestedNameSpecifierLoc range computation incorrect");
117 if (!Builder.getRepresentation())
119 return Builder.getTemporary().getLocalBeginLoc();
124 if (!Builder.getRepresentation())
127 return Builder.getWithLocInContext(Context);
139 bool RefQualifierIsLvalueRef,
147 unsigned NumExceptions,
157 TrailingReturnTypeLoc,
160 "function cannot have _Atomic qualifier");
164 I.
Loc = LocalRangeBegin;
212 if (!TheDeclarator.InlineStorageUsed &&
217 TheDeclarator.InlineStorageUsed =
true;
222 for (
unsigned i = 0; i < NumParams; i++)
234 for (
unsigned i = 0; i != NumExceptions; ++i) {
252 if (!DeclsInPrototype.empty()) {
253 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
254 "cannot have exception specifiers and decls in prototype");
258 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
269 assert(!
hasName() &&
"declarator given multiple names!");
271 BindingGroup.LSquareLoc = LSquareLoc;
272 BindingGroup.RSquareLoc = RSquareLoc;
273 BindingGroup.NumBindings =
Bindings.size();
274 Range.setEnd(RSquareLoc);
278 Name.EndLocation = RSquareLoc;
284 BindingGroup.DeleteBindings =
false;
285 InlineStorageUsed =
true;
287 BindingGroup.Bindings =
289 BindingGroup.DeleteBindings =
true;
292 BindingGroup.Bindings);
297 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
298 switch (DeclTypeInfo[i].Kind) {
311 llvm_unreachable(
"Invalid type chunk");
314 switch (DS.getTypeSpecType()) {
349#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
350#include "clang/Basic/OpenCLImageTypes.def"
351#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case TST_##Name:
352#include "clang/Basic/HLSLIntangibleTypes.def"
363 if (
Expr *E = DS.getRepAsExpr())
364 return E->getType()->isFunctionType();
367#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case TST_##Trait:
368#include "clang/Basic/Traits.inc"
372 QualType QT = DS.getRepAsType().get();
376 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
386 llvm_unreachable(
"Invalid TypeSpecType!");
395 getName().OperatorFunctionId.Operator));
403 auto *P = dyn_cast_or_null<ParmVarDecl>(Fun.
Params[0].
Param);
404 if (P && P->isExplicitObjectParameter())
418 Handle(
TQ_const,
"const", TQ_constLoc);
455 FS_noreturn_specified || FS_forceinline_specified)
461 const char *&PrevSpec,
463 bool IsExtension =
true) {
466 DiagID = diag::err_invalid_decl_spec_combination;
468 DiagID = IsExtension ? diag::ext_warn_duplicate_declspec :
469 diag::warn_duplicate_declspec;
484 llvm_unreachable(
"Unknown typespec!");
494 llvm_unreachable(
"Unknown typespec!");
500 return "unspecified";
508 llvm_unreachable(
"Unknown typespec!");
517 llvm_unreachable(
"Unknown typespec!");
523 return "unspecified";
529 llvm_unreachable(
"Unknown typespec!");
564 return "type-name-pack-indexing";
573#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
574 case DeclSpec::TST_##Trait: \
576#include "clang/Basic/Traits.inc"
580#define GENERIC_IMAGE_TYPE(ImgType, Id) \
581 case DeclSpec::TST_##ImgType##_t: \
582 return #ImgType "_t";
583#include "clang/Basic/OpenCLImageTypes.def"
584#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
585 case DeclSpec::TST_##Name: \
587#include "clang/Basic/HLSLIntangibleTypes.def"
590 llvm_unreachable(
"Unknown typespec!");
596 return "unspecified";
604 llvm_unreachable(
"Unknown ConstexprSpecKind");
616 llvm_unreachable(
"Unknown typespec!");
622 return "unspecified";
628 llvm_unreachable(
"Unknown overflow behavior state!");
632 const char *&PrevSpec,
644 "cl_clang_storage_class_specifiers", S.
getLangOpts())) {
650 DiagID = diag::err_opencl_unknown_type_specifier;
657 DiagID = diag::err_opencl_unknown_type_specifier;
673 PrevSpec, DiagID, Policy);
674 assert(!
isInvalid &&
"auto SCS -> TST recovery failed");
682 !(SCS_extern_in_linkage_spec &&
687 StorageClassSpec = SC;
688 StorageClassSpecLoc = Loc;
689 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
694 const char *&PrevSpec,
699 ThreadStorageClassSpec =
TSC;
700 ThreadStorageClassSpecLoc = Loc;
708 const char *&PrevSpec,
unsigned &DiagID,
713 TSWRange.setBegin(Loc);
718 TypeSpecWidth =
static_cast<unsigned>(W);
720 TSWRange.setEnd(Loc);
725 const char *&PrevSpec,
735 const char *&PrevSpec,
unsigned &DiagID) {
738 TypeSpecSign =
static_cast<unsigned>(S);
744 const char *&PrevSpec,
753 const char *&PrevSpec,
757 assert(
isTypeRep(
T) &&
"T does not store a type");
758 assert(Rep &&
"no type provided!");
762 setConflictingTypeSpecifier(
T, TagKwLoc, TagNameLoc, Rep);
764 DiagID = diag::err_invalid_decl_spec_combination;
770 TSTNameLoc = TagNameLoc;
771 TypeSpecOwned =
false;
779 PackIndexingExpr = LIT->getIndexExpr();
785 const char *&PrevSpec,
789 assert(isExprRep(
T) &&
"T does not store an expr");
790 assert(Rep &&
"no expression provided!");
794 setConflictingTypeSpecifier(
T, Loc, Rep);
796 DiagID = diag::err_invalid_decl_spec_combination;
803 TypeSpecOwned =
false;
808 const char *&PrevSpec,
810 Decl *Rep,
bool Owned,
817 const char *&PrevSpec,
819 Decl *Rep,
bool Owned,
821 assert(
isDeclRep(
T) &&
"T does not store a decl");
827 setConflictingTypeSpecifier(
T, TagKwLoc, TagNameLoc, Rep, Owned);
829 DiagID = diag::err_invalid_decl_spec_combination;
835 TSTNameLoc = TagNameLoc;
836 TypeSpecOwned = Owned && Rep !=
nullptr;
844 ConstrainedAuto =
true;
850 const char *&PrevSpec,
854 "rep required for these type-spec kinds!");
858 setConflictingTypeSpecifier(
T, Loc);
860 DiagID = diag::err_invalid_decl_spec_combination;
865 if (TypeAltiVecVector && (
T ==
TST_bool) && !TypeAltiVecBool) {
866 TypeAltiVecBool =
true;
870 TypeSpecOwned =
false;
878 DiagID = diag::warn_duplicate_declspec;
888 const char *&PrevSpec,
unsigned &DiagID,
894 DiagID = diag::err_invalid_vector_decl_spec_combination;
897 TypeAltiVecVector = isAltiVecVector;
903 const char *&PrevSpec,
unsigned &DiagID,
909 DiagID = diag::err_invalid_decl_spec_combination;
920 const char *&PrevSpec,
unsigned &DiagID,
924 if (!TypeAltiVecVector || TypeAltiVecPixel ||
927 DiagID = diag::err_invalid_pixel_decl_spec_combination;
930 TypeAltiVecPixel = isAltiVecPixel;
937 const char *&PrevSpec,
unsigned &DiagID,
941 if (!TypeAltiVecVector || TypeAltiVecBool ||
944 DiagID = diag::err_invalid_vector_bool_decl_spec;
947 TypeAltiVecBool = isAltiVecBool;
955 TypeSpecOwned =
false;
962 const char *&PrevSpec,
unsigned &DiagID,
964 assert(BitsExpr &&
"no expression provided!");
970 DiagID = diag::err_invalid_decl_spec_combination;
978 TypeSpecOwned =
false;
983 Expr *IndexingExpr) {
985 "pack indexing can only be applied to typename");
987 PackIndexingExpr = IndexingExpr;
988 this->EllipsisLoc = EllipsisLoc;
997 if (TypeQualifiers &
T) {
998 bool IsExtension =
true;
1000 IsExtension =
false;
1008 TypeQualifiers |=
T;
1012 case TQ_const: TQ_constLoc = Loc;
return false;
1013 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
1014 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
1015 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
1016 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
1019 llvm_unreachable(
"Unknown type qualifier!");
1023 OverflowBehaviorType::OverflowBehaviorKind Kind,
SourceLocation Loc,
1024 const char *&PrevSpec,
unsigned &DiagID) {
1026 (Kind == OverflowBehaviorType::OverflowBehaviorKind::Wrap)
1033 return BadSpecifier(NewState, CurrentState, PrevSpec, DiagID);
1036 OB_state =
static_cast<unsigned>(NewState);
1045 if (FS_inline_specified) {
1046 DiagID = diag::warn_duplicate_declspec;
1047 PrevSpec =
"inline";
1050 FS_inline_specified =
true;
1057 if (FS_forceinline_specified) {
1058 DiagID = diag::warn_duplicate_declspec;
1059 PrevSpec =
"__forceinline";
1062 FS_forceinline_specified =
true;
1063 FS_forceinlineLoc = Loc;
1068 const char *&PrevSpec,
1072 if (FS_virtual_specified) {
1073 DiagID = diag::warn_duplicate_declspec;
1074 PrevSpec =
"virtual";
1077 FS_virtual_specified =
true;
1078 FS_virtualLoc = Loc;
1083 const char *&PrevSpec,
unsigned &DiagID,
1089 DiagID = (ExplicitSpec.
getExpr() || FS_explicit_specifier.getExpr())
1090 ? diag::err_duplicate_declspec
1091 : diag::ext_warn_duplicate_declspec;
1092 PrevSpec =
"explicit";
1095 FS_explicit_specifier = ExplicitSpec;
1096 FS_explicitLoc = Loc;
1097 FS_explicitCloseParenLoc = CloseParenLoc;
1102 const char *&PrevSpec,
1106 if (FS_noreturn_specified) {
1107 DiagID = diag::warn_duplicate_declspec;
1108 PrevSpec =
"_Noreturn";
1111 FS_noreturn_specified =
true;
1112 FS_noreturnLoc = Loc;
1119 PrevSpec =
"friend";
1120 DiagID = diag::warn_duplicate_declspec;
1124 FriendSpecifiedFirst =
isEmpty();
1132 PrevSpec =
"__module_private__";
1133 DiagID = diag::ext_warn_duplicate_declspec;
1137 ModulePrivateLoc = Loc;
1147 ConstexprSpecifier =
static_cast<unsigned>(ConstexprKind);
1152void DeclSpec::SaveWrittenBuiltinSpecs() {
1165 SaveWrittenBuiltinSpecs();
1173 assert(!TypeSpecOwned ||
isDeclRep((
TST)TypeSpecType));
1191 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1193 const unsigned NumLocs = 9;
1195 TSWRange.getBegin(), TSCLoc, TSSLoc,
1196 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1197 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1200 for (
unsigned I = 0; I != NumLocs; ++I) {
1201 if (ExtraLocs[I].isValid()) {
1205 FirstLoc = ExtraLocs[I];
1212 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1214 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1215 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1216 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1237 const char *PrevSpec =
"auto";
1238 unsigned DiagID = diag::err_invalid_decl_spec_combination;
1239 S.
Diag(ConflictingTypeSpecifierLoc, DiagID) << PrevSpec << PrevSpec;
1251 S.
Diag(TSTLoc, diag::err_invalid_decl_spec_combination)
1256 StorageClassSpecLoc = TSTLoc;
1257 TypeSpecType = ConflictingTypeSpecifier;
1258 TSTLoc = ConflictingTypeSpecifierLoc;
1263 }
else if (ConflictingTypeSpecifier ==
TST_auto) {
1274 const char *PrevSpec =
1276 unsigned DiagID = diag::err_invalid_decl_spec_combination;
1277 S.
Diag(ConflictingTypeSpecifierLoc, DiagID) << PrevSpec <<
"auto";
1287 S.
Diag(ConflictingTypeSpecifierLoc,
1288 diag::err_invalid_decl_spec_combination)
1294 StorageClassSpecLoc = ConflictingTypeSpecifierLoc;
1308 const char *PrevSpec =
nullptr;
1309 unsigned DiagID = 0;
1311 S,
SCS_auto, TSTLoc, PrevSpec, DiagID,
1315 S.
Diag(TSTLoc, DiagID)
1318 S.
Diag(TSTLoc, DiagID) << PrevSpec;
1323 StorageClassSpecLoc = TSTLoc;
1324 TypeSpecType = ConflictingTypeSpecifier;
1325 TSTLoc = ConflictingTypeSpecifierLoc;
1330 }
else if (ConflictingTypeSpecifier ==
TST_auto) {
1333 const char *PrevSpec =
nullptr;
1334 unsigned DiagID = 0;
1339 S.
Diag(ConflictingTypeSpecifierLoc, DiagID)
1342 S.
Diag(ConflictingTypeSpecifierLoc, DiagID) << PrevSpec;
1347 StorageClassSpecLoc = ConflictingTypeSpecifierLoc;
1359 S.
Diag(ConflictingTypeSpecifierLoc, diag::err_auto_type_specifier)
1361 }
else if (ConflictingTypeSpecifier ==
TST_auto) {
1363 S.
Diag(ConflictingTypeSpecifierLoc, diag::err_auto_type_specifier)
1368 TypeSpecOwned =
false;
1376 StorageClassSpecLoc = TSTLoc;
1377 TypeSpecType = ConflictingTypeSpecifier;
1378 TSTLoc = ConflictingTypeSpecifierLoc;
1382 }
else if (ConflictingTypeSpecifier ==
TST_auto) {
1385 StorageClassSpecLoc = ConflictingTypeSpecifierLoc;
1395 if (TypeAltiVecVector) {
1400 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_long_decl_spec);
1406 S.
Diag(TSTLoc, diag::err_invalid_vector_int128_decl_spec);
1410 S.
Diag(TSCLoc, diag::err_invalid_vector_complex_decl_spec);
1411 else if (TypeAltiVecBool) {
1414 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1423 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1424 << (TypeAltiVecPixel ?
"__pixel" :
1431 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_int128_decl_spec);
1437 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1450 S.
Diag(TSWRange.getBegin(),
1451 diag::err_invalid_vector_long_double_decl_spec);
1454 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1460 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1472 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1474 S.
Diag(TSWRange.getBegin(),
1475 diag::warn_vector_long_decl_spec_combination)
1479 if (TypeAltiVecPixel) {
1484 TypeSpecOwned =
false;
1488 bool IsFixedPointType =
1497 !IsFixedPointType && TypeSpecType !=
TST_bitint) {
1498 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1513 else if (!(TypeSpecType ==
TST_int ||
1514 (IsFixedPointType &&
1516 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1519 TypeSpecSat =
false;
1520 TypeSpecOwned =
false;
1527 !IsFixedPointType) {
1528 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1531 TypeSpecSat =
false;
1532 TypeSpecOwned =
false;
1541 S.
Diag(TSCLoc, diag::ext_plain_complex)
1549 S.
Diag(TSTLoc, diag::ext_integer_complex);
1554 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1564 switch (StorageClassSpec) {
1574 diag::err_invalid_decl_spec_combination)
1579 diag::err_invalid_decl_spec_combination)
1588 S.
Diag(ConstexprLoc, diag::err_invalid_decl_spec_combination)
1610 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1617 S.
Diag(TSTLoc, diag::ext_auto_type_specifier) << 0;
1621 S.
Diag(TSTLoc, diag::ext_hlsl_auto_type_specifier) << 1;
1625 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1628 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1630 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1631 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1633 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1635 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
1637 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_constinit);
1657 if (!SpecName.empty()) SpecName +=
" ";
1663 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1664 << SpecName << StorageHint << ThreadHint;
1691 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1694 FS_virtual_specified =
false;
1714 for (
unsigned I = 0; I != 3; ++I) {
1717 if (SymbolLocations[I].
isValid())
1723 const char *&PrevSpec) {
1724 if (!FirstLocation.isValid())
1725 FirstLocation = Loc;
1729 if (Specifiers & VS) {
1737 default: llvm_unreachable(
"Unknown specifier!");
1741 case VS_Final: VS_finalLoc = Loc;
break;
1750 default: llvm_unreachable(
"Unknown specifier");
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static bool BadSpecifier(T TNew, T TPrev, const char *&PrevSpec, unsigned &DiagID, bool IsExtension=true)
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the clang::LangOptions interface.
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
static bool isInvalid(LocType Loc, bool *Invalid)
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const TargetInfo & getTargetInfo() const
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Represents a C++ struct/union/class.
void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc)
Make a nested-name-specifier of the form 'type::'.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
void Extend(ASTContext &Context, NamespaceBaseDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'name...
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Captures information about "declaration specifiers".
bool isVirtualSpecified() const
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
bool isModulePrivateSpecified() const
static const TSCS TSCS___thread
static const TST TST_typeof_unqualType
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_typename
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
ThreadStorageClassSpecifier TSCS
static const TST TST_char8
static const TST TST_BFloat16
void ClearStorageClassSpecs()
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TSCS TSCS__Thread_local
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
TST getTypeSpecType() const
SourceLocation getStorageClassSpecLoc() const
SCS getStorageClassSpec() const
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void SetPackIndexingExpr(SourceLocation EllipsisLoc, Expr *Pack)
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_auto_type
static const TST TST_interface
static const TST TST_double
static const TST TST_typeofExpr
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_union
static const TST TST_typename_pack_indexing
void CheckFriendSpec(Sema &S, const PrintingPolicy &Policy)
static const TST TST_char
static const TST TST_bool
static const TST TST_char16
SCS
storage-class-specifier
SourceLocation getExplicitSpecLoc() const
static const TST TST_unknown_anytype
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
TSCS getThreadStorageClassSpec() const
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_accum
static const TST TST_half
ParsedAttributes & getAttributes()
bool SetOverflowBehavior(OverflowBehaviorType::OverflowBehaviorKind Kind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceRange getExplicitSpecRange() const
static const TST TST_ibm128
static const TST TST_enum
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
AttributePool & getAttributePool() const
static const TST TST_float128
static const TST TST_decltype
static bool isDeclRep(TST T)
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Complex" (la...
static const TST TST_typeof_unqualExpr
static const TST TST_class
bool hasTagDefinition() const
static const TST TST_decimal64
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
bool SetTypeQual(TQ T, SourceLocation Loc)
static const TST TST_wchar
SourceLocation getTypeSpecComplexLoc() const
static const TST TST_void
static const TSCS TSCS_unspecified
static const TST TST_bitint
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
static const TST TST_float
static const TST TST_atomic
static const TST TST_fract
SourceLocation getThreadStorageClassSpecLoc() const
Decl * getRepAsDecl() const
static const TST TST_float16
static const TST TST_unspecified
SourceLocation getVirtualSpecLoc() const
TypeSpecifierSign getTypeSpecSign() const
SourceLocation getConstexprSpecLoc() const
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
OverflowBehaviorState getOverflowBehaviorState() const
static const TST TST_decltype_auto
static const TSCS TSCS_thread_local
static const TST TST_error
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal32
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
TypeSpecifierWidth getTypeSpecWidth() const
static const TST TST_char32
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal128
static const TST TST_int128
void CheckTypeSpec(Sema &S, const PrintingPolicy &Policy)
FriendSpecified isFriendSpecified() const
bool hasExplicitSpecifier() const
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_typeofType
TemplateIdAnnotation * TemplateIdRep
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_auto
@ PQ_StorageClassSpecifier
ConstexprSpecKind getConstexprSpecifier() const
static const TST TST_struct
Decl - This represents one declaration (or definition), e.g.
Information about one declarator, including the parsed type information and the identifier.
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
void SetIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
void setDecompositionBindings(SourceLocation LSquareLoc, MutableArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
DeclaratorContext getContext() const
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
The template parameter lists that preceded the declarator.
bool isExplicitObjectMemberFunction()
bool isStaticMember()
Returns true if this declares a static member.
DecompositionDeclarator::Binding InlineBindings[16]
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Store information needed for an explicit specifier.
const Expr * getExpr() const
This represents one expression.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::string getOpenCLVersionString() const
Return the OpenCL C or C++ for OpenCL language name and version as a string.
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
This represents a decl that may have a name.
Represents C++ namespaces and their aliases.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static OpaquePtr make(QualType P)
bool isAvailableOption(llvm::StringRef Ext, const LangOptions &LO) const
bool hasAttribute(ParsedAttr::Kind K) const
void takeAllPrependingFrom(ParsedAttributes &Other)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
SourceManager & getSourceManager() const
OpenCLOptions & getOpenCLOptions()
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
Base wrapper for a particular "section" of type source info.
SourceLocation getBeginLoc() const
Get the begin source location.
bool isFunctionType() const
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
static const char * getSpecifierName(Specifier VS)
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
@ TST_typename_pack_indexing
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ConstexprSpecKind
Define the kind of constexpr specifier.
@ IK_TemplateId
A template-id, e.g., f<int>.
@ IK_ConstructorTemplateId
A constructor named via a template-id.
@ IK_ConstructorName
A constructor name.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
ActionResult< ParsedType > TypeResult
const FunctionProtoType * T
@ Keyword
The name has been typo-corrected to a keyword.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
U cast(CodeGen::Address addr)
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Unparsed
not parsed yet
@ EST_None
no exception specification
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed.
SourceLocation MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
AttributeFactory * QualAttrFactory
AttributeFactory for the MethodQualifiers.
SourceLocation ExceptionSpecLocEnd
The end location of the exception specification, if any.
SourceLocation EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
SourceLocation RefQualifierLoc
The location of the ref-qualifier, if any.
SourceLocation RParenLoc
The location of the right parenthesis in the source.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
SourceLocation LParenLoc
The location of the left parenthesis in the source.
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
SourceLocation ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
SourceLocation TrailingReturnTypeLoc
If HasTrailingReturnType is true, this is the location of the trailing return type.
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
SourceLocation Loc
Loc - The place where this type was defined.
enum clang::DeclaratorChunk::@340323374315200305336204205154073066142310370142 Kind
Describes how types, statements, expressions, and declarations should be printed.
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool',...
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
Information about a template-id annotation token.