26#include "llvm/ADT/STLExtras.h"
27#include "llvm/ADT/SmallString.h"
33 assert(
TemplateId &&
"NULL template-id annotation?");
35 "should not convert invalid template-ids to unqualified-ids");
44 assert(
TemplateId &&
"NULL template-id annotation?");
46 "should not convert invalid template-ids to unqualified-ids");
56 Builder.
Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
59 Range.
setEnd(ColonColonLoc);
62 "NestedNameSpecifierLoc range computation incorrect");
72 Range.
setEnd(ColonColonLoc);
75 "NestedNameSpecifierLoc range computation incorrect");
81 Builder.
Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
85 Range.
setEnd(ColonColonLoc);
88 "NestedNameSpecifierLoc range computation incorrect");
94 Builder.
Extend(Context, Alias, AliasLoc, ColonColonLoc);
98 Range.
setEnd(ColonColonLoc);
101 "NestedNameSpecifierLoc range computation incorrect");
111 "NestedNameSpecifierLoc range computation incorrect");
117 Builder.
MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
120 Range.
setEnd(ColonColonLoc);
123 "NestedNameSpecifierLoc range computation incorrect");
139 Range =
Other.getSourceRange();
142 "NestedNameSpecifierLoc range computation incorrect");
168 bool RefQualifierIsLvalueRef,
176 unsigned NumExceptions,
186 TrailingReturnTypeLoc,
189 "function cannot have _Atomic qualifier");
193 I.
Loc = LocalRangeBegin;
241 if (!TheDeclarator.InlineStorageUsed &&
246 TheDeclarator.InlineStorageUsed =
true;
251 for (
unsigned i = 0; i < NumParams; i++)
263 for (
unsigned i = 0; i != NumExceptions; ++i) {
281 if (!DeclsInPrototype.empty()) {
282 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
283 "cannot have exception specifiers and decls in prototype");
287 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
298 assert(!
hasName() &&
"declarator given multiple names!");
300 BindingGroup.LSquareLoc = LSquareLoc;
301 BindingGroup.RSquareLoc = RSquareLoc;
302 BindingGroup.NumBindings =
Bindings.size();
313 BindingGroup.DeleteBindings =
false;
314 InlineStorageUsed =
true;
316 BindingGroup.Bindings =
318 BindingGroup.DeleteBindings =
true;
321 BindingGroup.Bindings);
326 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
327 switch (DeclTypeInfo[i].Kind) {
340 llvm_unreachable(
"Invalid type chunk");
378#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
379#include "clang/Basic/OpenCLImageTypes.def"
391 return E->getType()->isFunctionType();
394#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case TST_##Trait:
395#include "clang/Basic/TransformTypeTraits.def"
403 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
413 llvm_unreachable(
"Invalid TypeSpecType!");
421 getName().OperatorFunctionId.Operator));
429 auto *
P = dyn_cast_or_null<ParmVarDecl>(Fun.
Params[0].
Param);
430 if (
P &&
P->isExplicitObjectParameter())
444 Handle(
TQ_const,
"const", TQ_constLoc);
462 return cast<TagDecl>(
getRepAsDecl())->isCompleteDefinition();
481 FS_noreturn_specified || FS_forceinline_specified)
487 const char *&PrevSpec,
489 bool IsExtension =
true) {
492 DiagID = diag::err_invalid_decl_spec_combination;
494 DiagID = IsExtension ? diag::ext_warn_duplicate_declspec :
495 diag::warn_duplicate_declspec;
510 llvm_unreachable(
"Unknown typespec!");
520 llvm_unreachable(
"Unknown typespec!");
526 return "unspecified";
534 llvm_unreachable(
"Unknown typespec!");
543 llvm_unreachable(
"Unknown typespec!");
549 return "unspecified";
555 llvm_unreachable(
"Unknown typespec!");
590 return "type-name-pack-indexing";
599#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
600 case DeclSpec::TST_##Trait: \
602#include "clang/Basic/TransformTypeTraits.def"
606#define GENERIC_IMAGE_TYPE(ImgType, Id) \
607 case DeclSpec::TST_##ImgType##_t: \
608 return #ImgType "_t";
609#include "clang/Basic/OpenCLImageTypes.def"
612 llvm_unreachable(
"Unknown typespec!");
618 return "unspecified";
626 llvm_unreachable(
"Unknown ConstexprSpecKind");
638 llvm_unreachable(
"Unknown typespec!");
642 const char *&PrevSpec,
654 "cl_clang_storage_class_specifiers", S.
getLangOpts())) {
660 DiagID = diag::err_opencl_unknown_type_specifier;
667 DiagID = diag::err_opencl_unknown_type_specifier;
683 PrevSpec, DiagID, Policy);
684 assert(!
isInvalid &&
"auto SCS -> TST recovery failed");
692 !(SCS_extern_in_linkage_spec &&
697 StorageClassSpec = SC;
698 StorageClassSpecLoc = Loc;
699 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
704 const char *&PrevSpec,
709 ThreadStorageClassSpec =
TSC;
710 ThreadStorageClassSpecLoc = Loc;
718 const char *&PrevSpec,
unsigned &DiagID,
728 TypeSpecWidth =
static_cast<unsigned>(W);
735 const char *&PrevSpec,
745 const char *&PrevSpec,
unsigned &DiagID) {
748 TypeSpecSign =
static_cast<unsigned>(S);
754 const char *&PrevSpec,
763 const char *&PrevSpec,
767 assert(
isTypeRep(T) &&
"T does not store a type");
768 assert(Rep &&
"no type provided!");
773 DiagID = diag::err_invalid_decl_spec_combination;
779 TSTNameLoc = TagNameLoc;
780 TypeSpecOwned =
false;
794 const char *&PrevSpec,
798 assert(isExprRep(T) &&
"T does not store an expr");
799 assert(Rep &&
"no expression provided!");
804 DiagID = diag::err_invalid_decl_spec_combination;
811 TypeSpecOwned =
false;
816 const char *&PrevSpec,
818 Decl *Rep,
bool Owned,
820 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
825 const char *&PrevSpec,
827 Decl *Rep,
bool Owned,
829 assert(
isDeclRep(T) &&
"T does not store a decl");
836 DiagID = diag::err_invalid_decl_spec_combination;
842 TSTNameLoc = TagNameLoc;
843 TypeSpecOwned = Owned && Rep !=
nullptr;
851 ConstrainedAuto =
true;
857 const char *&PrevSpec,
861 "rep required for these type-spec kinds!");
866 DiagID = diag::err_invalid_decl_spec_combination;
871 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
872 TypeAltiVecBool =
true;
876 TypeSpecOwned =
false;
884 DiagID = diag::warn_duplicate_declspec;
894 const char *&PrevSpec,
unsigned &DiagID,
900 DiagID = diag::err_invalid_vector_decl_spec_combination;
903 TypeAltiVecVector = isAltiVecVector;
909 const char *&PrevSpec,
unsigned &DiagID,
915 DiagID = diag::err_invalid_decl_spec_combination;
926 const char *&PrevSpec,
unsigned &DiagID,
930 if (!TypeAltiVecVector || TypeAltiVecPixel ||
933 DiagID = diag::err_invalid_pixel_decl_spec_combination;
936 TypeAltiVecPixel = isAltiVecPixel;
943 const char *&PrevSpec,
unsigned &DiagID,
947 if (!TypeAltiVecVector || TypeAltiVecBool ||
950 DiagID = diag::err_invalid_vector_bool_decl_spec;
953 TypeAltiVecBool = isAltiVecBool;
961 TypeSpecOwned =
false;
968 const char *&PrevSpec,
unsigned &DiagID,
970 assert(BitsExpr &&
"no expression provided!");
976 DiagID = diag::err_invalid_decl_spec_combination;
984 TypeSpecOwned =
false;
989 Expr *IndexingExpr) {
991 "pack indexing can only be applied to typename");
994 this->EllipsisLoc = EllipsisLoc;
1003 if (TypeQualifiers & T) {
1004 bool IsExtension =
true;
1006 IsExtension =
false;
1007 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
1014 TypeQualifiers |= T;
1018 case TQ_const: TQ_constLoc = Loc;
return false;
1019 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
1020 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
1021 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
1022 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
1025 llvm_unreachable(
"Unknown type qualifier!");
1032 if (FS_inline_specified) {
1033 DiagID = diag::warn_duplicate_declspec;
1034 PrevSpec =
"inline";
1037 FS_inline_specified =
true;
1044 if (FS_forceinline_specified) {
1045 DiagID = diag::warn_duplicate_declspec;
1046 PrevSpec =
"__forceinline";
1049 FS_forceinline_specified =
true;
1050 FS_forceinlineLoc = Loc;
1055 const char *&PrevSpec,
1059 if (FS_virtual_specified) {
1060 DiagID = diag::warn_duplicate_declspec;
1061 PrevSpec =
"virtual";
1064 FS_virtual_specified =
true;
1065 FS_virtualLoc = Loc;
1070 const char *&PrevSpec,
unsigned &DiagID,
1076 DiagID = (ExplicitSpec.
getExpr() || FS_explicit_specifier.
getExpr())
1077 ? diag::err_duplicate_declspec
1078 : diag::ext_warn_duplicate_declspec;
1079 PrevSpec =
"explicit";
1082 FS_explicit_specifier = ExplicitSpec;
1083 FS_explicitLoc = Loc;
1084 FS_explicitCloseParenLoc = CloseParenLoc;
1089 const char *&PrevSpec,
1093 if (FS_noreturn_specified) {
1094 DiagID = diag::warn_duplicate_declspec;
1095 PrevSpec =
"_Noreturn";
1098 FS_noreturn_specified =
true;
1099 FS_noreturnLoc = Loc;
1106 PrevSpec =
"friend";
1107 DiagID = diag::warn_duplicate_declspec;
1111 FriendSpecifiedFirst =
isEmpty();
1119 PrevSpec =
"__module_private__";
1120 DiagID = diag::ext_warn_duplicate_declspec;
1124 ModulePrivateLoc = Loc;
1134 ConstexprSpecifier =
static_cast<unsigned>(ConstexprKind);
1139void DeclSpec::SaveWrittenBuiltinSpecs() {
1152 SaveWrittenBuiltinSpecs();
1164 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1166 const unsigned NumLocs = 9;
1168 TSWRange.
getBegin(), TSCLoc, TSSLoc,
1169 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1170 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1173 for (
unsigned I = 0; I != NumLocs; ++I) {
1174 if (ExtraLocs[I].isValid()) {
1178 FirstLoc = ExtraLocs[I];
1185 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1187 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1188 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1189 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1193 if (TypeAltiVecVector) {
1198 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_vector_long_long_decl_spec);
1203 S.
Diag(TSTLoc, diag::err_invalid_vector_int128_decl_spec);
1205 if (TypeAltiVecBool) {
1208 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1217 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1218 << (TypeAltiVecPixel ?
"__pixel" :
1224 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_int128_decl_spec);
1230 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_vector_bool_decl_spec)
1244 diag::err_invalid_vector_long_double_decl_spec);
1247 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1253 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1265 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_vector_long_decl_spec);
1268 diag::warn_vector_long_decl_spec_combination)
1272 if (TypeAltiVecPixel) {
1277 TypeSpecOwned =
false;
1281 bool IsFixedPointType =
1290 !IsFixedPointType && TypeSpecType !=
TST_bitint) {
1291 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1306 else if (!(TypeSpecType ==
TST_int ||
1307 (IsFixedPointType &&
1309 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_width_spec)
1312 TypeSpecSat =
false;
1313 TypeSpecOwned =
false;
1320 !IsFixedPointType) {
1321 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_width_spec)
1324 TypeSpecSat =
false;
1325 TypeSpecOwned =
false;
1334 S.
Diag(TSCLoc, diag::ext_plain_complex)
1343 S.
Diag(TSTLoc, diag::ext_integer_complex);
1348 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1358 switch (StorageClassSpec) {
1368 diag::err_invalid_decl_spec_combination)
1373 diag::err_invalid_decl_spec_combination)
1382 S.
Diag(ConstexprLoc, diag::err_invalid_decl_spec_combination)
1391 S.
Diag(ConstexprLoc, diag::err_invalid_decl_spec_combination)
1404 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1411 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1414 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1417 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1419 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1420 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1422 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1424 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
1426 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_constinit);
1443 if (!SpecName.empty()) SpecName +=
" ";
1449 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1450 << SpecName << StorageHint << ThreadHint;
1468 Keyword =
"virtual";
1472 Keyword =
"explicit";
1477 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1480 FS_virtual_specified =
false;
1485 assert(!TypeSpecOwned ||
isDeclRep((
TST) TypeSpecType));
1508 for (
unsigned I = 0; I != 3; ++I) {
1511 if (SymbolLocations[I].
isValid())
1517 const char *&PrevSpec) {
1519 FirstLocation = Loc;
1523 if (Specifiers & VS) {
1531 default: llvm_unreachable(
"Unknown specifier!");
1535 case VS_Final: VS_finalLoc = Loc;
break;
1544 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)
Defines the clang::LangOptions interface.
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
The result of parsing/analyzing an expression, statement etc.
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 MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
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 MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
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.
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
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.
ParsedType getRepAsType() const
TSCS getThreadStorageClassSpec() const
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_accum
static const TST TST_half
ParsedAttributes & getAttributes()
SourceRange getExplicitSpecRange() const
static const TST TST_ibm128
Expr * getRepAsExpr() const
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 "_Imaginary" (...
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
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
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
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.
void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given 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.
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
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.
void setDecompositionBindings(SourceLocation LSquareLoc, ArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
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.
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
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 a C++ namespace alias.
Represent a C++ namespace.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
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.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
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
QualType getPattern() const
Expr * getIndexExpr() const
bool hasAttribute(ParsedAttr::Kind K) const
void takeAllFrom(ParsedAttributes &Other)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Sema - This implements semantic analysis and AST building for C.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
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.
void setBegin(SourceLocation b)
SourceLocation getEnd() const
SourceLocation getBegin() const
void setEnd(SourceLocation e)
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.
TypeSpecifierType
Specifies the kind of type.
@ 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+.
ThreadStorageClassSpecifier
Thread storage-class-specifier.
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.
@ 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.
One instance of this struct is used for each type in a declarator that is parsed.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
enum clang::DeclaratorChunk::@216 Kind
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.
Wraps an identifier and optional source location for the identifier.
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.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new",...
OverloadedOperatorKind Operator
The kind of overloaded operator.