24 #include "llvm/ADT/STLExtras.h" 25 #include "llvm/ADT/SmallString.h" 27 using namespace clang;
31 assert(TemplateId &&
"NULL template-id annotation?");
39 assert(TemplateId &&
"NULL template-id annotation?");
48 Builder.Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
49 if (Range.getBegin().isInvalid())
51 Range.setEnd(ColonColonLoc);
53 assert(Range == Builder.getSourceRange() &&
54 "NestedNameSpecifierLoc range computation incorrect");
60 Builder.Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
62 if (Range.getBegin().isInvalid())
63 Range.setBegin(IdentifierLoc);
64 Range.setEnd(ColonColonLoc);
66 assert(Range == Builder.getSourceRange() &&
67 "NestedNameSpecifierLoc range computation incorrect");
73 Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
75 if (Range.getBegin().isInvalid())
76 Range.setBegin(NamespaceLoc);
77 Range.setEnd(ColonColonLoc);
79 assert(Range == Builder.getSourceRange() &&
80 "NestedNameSpecifierLoc range computation incorrect");
86 Builder.Extend(Context, Alias, AliasLoc, ColonColonLoc);
88 if (Range.getBegin().isInvalid())
89 Range.setBegin(AliasLoc);
90 Range.setEnd(ColonColonLoc);
92 assert(Range == Builder.getSourceRange() &&
93 "NestedNameSpecifierLoc range computation incorrect");
98 Builder.MakeGlobal(Context, ColonColonLoc);
102 assert(Range == Builder.getSourceRange() &&
103 "NestedNameSpecifierLoc range computation incorrect");
109 Builder.MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
111 Range.setBegin(SuperLoc);
112 Range.setEnd(ColonColonLoc);
114 assert(Range == Builder.getSourceRange() &&
115 "NestedNameSpecifierLoc range computation incorrect");
120 Builder.MakeTrivial(Context, Qualifier, R);
132 Builder.Adopt(Other);
136 if (!Builder.getRepresentation())
138 return Builder.getTemporary().getLocalBeginLoc();
143 if (!Builder.getRepresentation())
146 return Builder.getWithLocInContext(Context);
158 bool RefQualifierIsLvalueRef,
166 unsigned NumExceptions,
177 "function cannot have _Atomic qualifier");
181 I.
Loc = LocalRangeBegin;
227 if (!TheDeclarator.InlineStorageUsed &&
228 NumParams <= llvm::array_lengthof(TheDeclarator.
InlineParams)) {
232 TheDeclarator.InlineStorageUsed =
true;
237 for (
unsigned i = 0; i < NumParams; i++)
249 for (
unsigned i = 0; i != NumExceptions; ++i) {
267 if (!DeclsInPrototype.empty()) {
268 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
269 "cannot have exception specifiers and decls in prototype");
273 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
284 assert(!
hasName() &&
"declarator given multiple names!");
286 BindingGroup.LSquareLoc = LSquareLoc;
287 BindingGroup.RSquareLoc = RSquareLoc;
288 BindingGroup.NumBindings = Bindings.size();
289 Range.setEnd(RSquareLoc);
292 SetIdentifier(
nullptr, LSquareLoc);
293 Name.EndLocation = RSquareLoc;
296 if (Bindings.size()) {
297 if (!InlineStorageUsed &&
298 Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
299 BindingGroup.Bindings = InlineBindings;
300 BindingGroup.DeleteBindings =
false;
301 InlineStorageUsed =
true;
303 BindingGroup.Bindings =
305 BindingGroup.DeleteBindings =
true;
307 std::uninitialized_copy(Bindings.begin(), Bindings.end(),
308 BindingGroup.Bindings);
313 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
314 switch (DeclTypeInfo[i].
Kind) {
327 llvm_unreachable(
"Invalid type chunk");
330 switch (DS.getTypeSpecType()) {
361 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 362 #include "clang/Basic/OpenCLImageTypes.def" 372 if (
Expr *E = DS.getRepAsExpr())
373 return E->getType()->isFunctionType();
379 QualType QT = DS.getRepAsType().get();
383 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
393 llvm_unreachable(
"Invalid TypeSpecType!");
411 if (TypeQualifiers & TQ_const)
412 Handle(TQ_const,
"const", TQ_constLoc);
413 if (TypeQualifiers & TQ_volatile)
414 Handle(TQ_volatile,
"volatile", TQ_volatileLoc);
415 if (TypeQualifiers & TQ_restrict)
416 Handle(TQ_restrict,
"restrict", TQ_restrictLoc);
417 if (TypeQualifiers & TQ_unaligned)
418 Handle(TQ_unaligned,
"unaligned", TQ_unalignedLoc);
423 forEachCVRUQualifier(Handle);
430 return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
438 if (StorageClassSpec != SCS_unspecified ||
440 Res |= PQ_StorageClassSpecifier;
442 if (TypeQualifiers != TQ_unspecified)
443 Res |= PQ_TypeQualifier;
445 if (hasTypeSpecifier())
446 Res |= PQ_TypeSpecifier;
448 if (FS_inline_specified || FS_virtual_specified || hasExplicitSpecifier() ||
449 FS_noreturn_specified || FS_forceinline_specified)
450 Res |= PQ_FunctionSpecifier;
455 const char *&PrevSpec,
457 bool IsExtension =
true) {
460 DiagID = diag::err_invalid_decl_spec_combination;
462 DiagID = IsExtension ? diag::ext_warn_duplicate_declspec :
463 diag::warn_duplicate_declspec;
478 llvm_unreachable(
"Unknown typespec!");
488 llvm_unreachable(
"Unknown typespec!");
498 llvm_unreachable(
"Unknown typespec!");
503 case TSC_unspecified:
return "unspecified";
504 case TSC_imaginary:
return "imaginary";
505 case TSC_complex:
return "complex";
507 llvm_unreachable(
"Unknown typespec!");
517 llvm_unreachable(
"Unknown typespec!");
558 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 559 case DeclSpec::TST_##ImgType##_t: \ 560 return #ImgType "_t"; 561 #include "clang/Basic/OpenCLImageTypes.def" 564 llvm_unreachable(
"Unknown typespec!");
574 llvm_unreachable(
"Unknown ConstexprSpecKind");
586 llvm_unreachable(
"Unknown typespec!");
590 const char *&PrevSpec,
604 case SCS_private_extern:
608 DiagID = diag::err_opencl_unknown_type_specifier;
609 PrevSpec = getSpecifierName(SC);
615 DiagID = diag::err_opencl_unknown_type_specifier;
616 PrevSpec = getSpecifierName(SC);
623 if (StorageClassSpec != SCS_unspecified) {
628 return SetTypeSpecType(
TST_auto, Loc, PrevSpec, DiagID, Policy);
629 if (StorageClassSpec == SCS_auto) {
630 isInvalid = SetTypeSpecType(
TST_auto, StorageClassSpecLoc,
631 PrevSpec, DiagID, Policy);
632 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
640 !(SCS_extern_in_linkage_spec &&
641 StorageClassSpec == SCS_extern &&
645 StorageClassSpec = SC;
646 StorageClassSpecLoc = Loc;
647 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
652 const char *&PrevSpec,
657 ThreadStorageClassSpec = TSC;
658 ThreadStorageClassSpecLoc = Loc;
666 const char *&PrevSpec,
672 TSWRange.setBegin(Loc);
678 TSWRange.setEnd(Loc);
683 const char *&PrevSpec,
685 if (TypeSpecComplex != TSC_unspecified)
693 const char *&PrevSpec,
703 const char *&PrevSpec,
707 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
712 const char *&PrevSpec,
716 assert(isTypeRep(T) &&
"T does not store a type");
717 assert(Rep &&
"no type provided!");
722 DiagID = diag::err_invalid_decl_spec_combination;
728 TSTNameLoc = TagNameLoc;
729 TypeSpecOwned =
false;
734 const char *&PrevSpec,
738 assert(isExprRep(T) &&
"T does not store an expr");
739 assert(Rep &&
"no expression provided!");
744 DiagID = diag::err_invalid_decl_spec_combination;
751 TypeSpecOwned =
false;
756 const char *&PrevSpec,
758 Decl *Rep,
bool Owned,
760 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
765 const char *&PrevSpec,
767 Decl *Rep,
bool Owned,
769 assert(isDeclRep(T) &&
"T does not store a decl");
776 DiagID = diag::err_invalid_decl_spec_combination;
782 TSTNameLoc = TagNameLoc;
783 TypeSpecOwned = Owned && Rep !=
nullptr;
791 ConstrainedAuto =
true;
793 return SetTypeSpecType(T, Loc, PrevSpec, DiagID, Policy);
797 const char *&PrevSpec,
800 assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
801 "rep required for these type-spec kinds!");
806 DiagID = diag::err_invalid_decl_spec_combination;
811 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
812 TypeAltiVecBool =
true;
816 TypeSpecOwned =
false;
824 DiagID = diag::warn_duplicate_declspec;
834 const char *&PrevSpec,
unsigned &DiagID,
840 DiagID = diag::err_invalid_vector_decl_spec_combination;
843 TypeAltiVecVector = isAltiVecVector;
849 const char *&PrevSpec,
unsigned &DiagID,
855 DiagID = diag::err_invalid_decl_spec_combination;
866 const char *&PrevSpec,
unsigned &DiagID,
870 if (!TypeAltiVecVector || TypeAltiVecPixel ||
873 DiagID = diag::err_invalid_pixel_decl_spec_combination;
876 TypeAltiVecPixel = isAltiVecPixel;
883 const char *&PrevSpec,
unsigned &DiagID,
887 if (!TypeAltiVecVector || TypeAltiVecBool ||
890 DiagID = diag::err_invalid_vector_bool_decl_spec;
893 TypeAltiVecBool = isAltiVecBool;
901 TypeSpecOwned =
false;
913 if (TypeQualifiers & T) {
914 bool IsExtension =
true;
917 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
920 return SetTypeQual(T, Loc);
927 case TQ_unspecified:
break;
928 case TQ_const: TQ_constLoc = Loc;
return false;
929 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
930 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
931 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
932 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
935 llvm_unreachable(
"Unknown type qualifier!");
942 if (FS_inline_specified) {
943 DiagID = diag::warn_duplicate_declspec;
947 FS_inline_specified =
true;
954 if (FS_forceinline_specified) {
955 DiagID = diag::warn_duplicate_declspec;
956 PrevSpec =
"__forceinline";
959 FS_forceinline_specified =
true;
960 FS_forceinlineLoc = Loc;
965 const char *&PrevSpec,
969 if (FS_virtual_specified) {
970 DiagID = diag::warn_duplicate_declspec;
971 PrevSpec =
"virtual";
974 FS_virtual_specified =
true;
980 const char *&PrevSpec,
unsigned &DiagID,
985 "invalid ExplicitSpecifier");
988 if (hasExplicitSpecifier()) {
989 DiagID = (ExplicitSpec.
getExpr() || FS_explicit_specifier.getExpr())
990 ? diag::err_duplicate_declspec
991 : diag::ext_warn_duplicate_declspec;
992 PrevSpec =
"explicit";
995 FS_explicit_specifier = ExplicitSpec;
996 FS_explicitLoc = Loc;
997 FS_explicitCloseParenLoc = CloseParenLoc;
1002 const char *&PrevSpec,
1006 if (FS_noreturn_specified) {
1007 DiagID = diag::warn_duplicate_declspec;
1008 PrevSpec =
"_Noreturn";
1011 FS_noreturn_specified =
true;
1012 FS_noreturnLoc = Loc;
1018 if (Friend_specified) {
1019 PrevSpec =
"friend";
1025 DiagID = diag::warn_duplicate_declspec;
1029 Friend_specified =
true;
1036 if (isModulePrivateSpecified()) {
1037 PrevSpec =
"__module_private__";
1038 DiagID = diag::ext_warn_duplicate_declspec;
1042 ModulePrivateLoc = Loc;
1050 return BadSpecifier(ConstexprKind, getConstexprSpecifier(), PrevSpec,
1052 ConstexprSpecifier = ConstexprKind;
1057 void DeclSpec::SaveWrittenBuiltinSpecs() {
1058 writtenBS.Sign = getTypeSpecSign();
1059 writtenBS.Width = getTypeSpecWidth();
1060 writtenBS.Type = getTypeSpecType();
1062 writtenBS.ModeAttr = getAttributes().hasAttribute(ParsedAttr::AT_Mode);
1071 SaveWrittenBuiltinSpecs();
1081 TypeSpecComplex != TSC_unspecified ||
1083 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1085 const unsigned NumLocs = 9;
1087 TSWRange.getBegin(), TSCLoc, TSSLoc,
1088 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1089 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1092 for (
unsigned I = 0; I != NumLocs; ++I) {
1097 FirstLoc = ExtraLocs[I];
1102 TypeSpecComplex = TSC_unspecified;
1104 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1106 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1107 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1108 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1112 if (TypeAltiVecVector) {
1113 if (TypeAltiVecBool) {
1116 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1117 << getSpecifierName((
TSS)TypeSpecSign);
1122 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1123 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1124 << (TypeAltiVecPixel ?
"__pixel" :
1125 getSpecifierName((
TST)TypeSpecType, Policy));
1131 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1132 << getSpecifierName((
TSW)TypeSpecWidth);
1139 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1149 S.
Diag(TSWRange.getBegin(),
1150 diag::err_invalid_vector_long_double_decl_spec);
1153 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1159 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1160 }
else if (TypeSpecWidth ==
TSW_long) {
1163 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1165 S.
Diag(TSWRange.getBegin(),
1166 diag::warn_vector_long_decl_spec_combination)
1167 << getSpecifierName((
TST)TypeSpecType, Policy);
1170 if (TypeAltiVecPixel) {
1175 TypeSpecOwned =
false;
1179 bool IsFixedPointType =
1180 TypeSpecType == TST_accum || TypeSpecType == TST_fract;
1188 !IsFixedPointType) {
1189 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1190 << getSpecifierName((
TST)TypeSpecType, Policy);
1197 switch (TypeSpecWidth) {
1203 else if (!(TypeSpecType ==
TST_int ||
1204 (IsFixedPointType && TypeSpecWidth !=
TSW_longlong))) {
1205 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1206 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1208 TypeSpecSat =
false;
1209 TypeSpecOwned =
false;
1216 !IsFixedPointType) {
1217 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1218 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1220 TypeSpecSat =
false;
1221 TypeSpecOwned =
false;
1228 if (TypeSpecComplex != TSC_unspecified) {
1230 S.
Diag(TSCLoc, diag::ext_plain_complex)
1238 S.
Diag(TSTLoc, diag::ext_integer_complex);
1240 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1241 << getSpecifierName((
TST)TypeSpecType, Policy);
1242 TypeSpecComplex = TSC_unspecified;
1250 switch (StorageClassSpec) {
1251 case SCS_unspecified:
1253 case SCS_private_extern:
1258 getThreadStorageClassSpecLoc(), getStorageClassSpecLoc()))
1259 S.
Diag(getStorageClassSpecLoc(),
1260 diag::err_invalid_decl_spec_combination)
1264 S.
Diag(getThreadStorageClassSpecLoc(),
1265 diag::err_invalid_decl_spec_combination)
1281 StorageClassSpec = SCS_unspecified;
1282 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1288 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1290 StorageClassSpec == SCS_auto)
1291 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1294 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1296 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1297 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1299 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1301 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
1303 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_constinit);
1307 if (isFriendSpecified() &&
1308 (getStorageClassSpec() || getThreadStorageClassSpec())) {
1314 SpecName = getSpecifierName(SC);
1315 SCLoc = getStorageClassSpecLoc();
1320 if (!SpecName.empty()) SpecName +=
" ";
1321 SpecName += getSpecifierName(
TSC);
1322 SCLoc = getThreadStorageClassSpecLoc();
1326 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1327 << SpecName << StorageHint << ThreadHint;
1329 ClearStorageClassSpecs();
1339 if (isFriendSpecified() && (isVirtualSpecified() || hasExplicitSpecifier())) {
1344 if (isVirtualSpecified()) {
1345 Keyword =
"virtual";
1346 SCLoc = getVirtualSpecLoc();
1349 Keyword =
"explicit";
1350 SCLoc = getExplicitSpecLoc();
1354 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1357 FS_virtual_specified =
false;
1362 assert(!TypeSpecOwned || isDeclRep((
TST) TypeSpecType));
1372 TST tst = getTypeSpecType();
1373 return isDeclRep(tst) && getRepAsDecl() !=
nullptr &&
1384 for (
unsigned I = 0; I != 3; ++I) {
1387 if (SymbolLocations[I].
isValid())
1393 const char *&PrevSpec) {
1394 if (!FirstLocation.isValid())
1395 FirstLocation = Loc;
1399 if (Specifiers & VS) {
1400 PrevSpec = getSpecifierName(VS);
1407 default: llvm_unreachable(
"Unknown specifier!");
1408 case VS_Override: VS_overrideLoc = Loc;
break;
1411 case VS_Final: VS_finalLoc = Loc;
break;
1419 default: llvm_unreachable(
"Unknown specifier");
1420 case VS_Override:
return "override";
1421 case VS_Final:
return "final";
1422 case VS_GNU_Final:
return "__final";
1423 case VS_Sealed:
return "sealed";
Defines the clang::ASTContext interface.
unsigned MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
no exception specification
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
A (possibly-)qualified type.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
bool SetTypeQual(TQ T, SourceLocation Loc)
static const TST TST_wchar
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
static const TST TST_typeofExpr
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
static const TST TST_char16
Decl - This represents one declaration (or definition), e.g.
unsigned ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
unsigned EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
A constructor named via a template-id.
ExplicitSpecKind getKind() const
One instance of this struct is used for each type in a declarator that is parsed. ...
Represent a C++ namespace.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
const TargetInfo & getTargetInfo() const
static const char * getSpecifierName(Specifier VS)
Store information needed for an explicit specifier.
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
An overloaded operator name, e.g., operator+.
unsigned RefQualifierLoc
The location of the ref-qualifier, if any.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
static const TSCS TSCS_unspecified
static const TST TST_underlyingType
Information about one declarator, including the parsed type information and the identifier.
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
TypeSpecifierType
Specifies the kind of type.
static const TST TST_interface
static const TST TST_char
Describes how types, statements, expressions, and declarations should be printed. ...
OpenCLOptions & getOpenCLOptions()
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
noexcept(expression), value-dependent
Information about a template-id annotation token.
static const TST TST_unknown_anytype
Base wrapper for a particular "section" of type source info.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
One of these records is kept for each identifier that is lexed.
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
static const TST TST_decimal32
static const TST TST_char8
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
static const TST TST_class
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
OverloadedOperatorKind Operator
The kind of overloaded operator.
static const TST TST_double
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_error
static const TST TST_enum
bool hasTagDefinition() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static const TST TST_accum
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SCS
storage-class-specifier
void takeAllFrom(ParsedAttributes &attrs)
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
unsigned RParenLoc
The location of the right parenthesis in the source.
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
const LangOptions & getLangOpts() const
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
static const TST TST_float
Sema - This implements semantic analysis and AST building for C.
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(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function...
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
bool isEnabled(llvm::StringRef Ext) const
SourceLocation getBeginLoc() const
Get the begin source location.
This represents one expression.
Defines the clang::LangOptions interface.
void setDecompositionBindings(SourceLocation LSquareLoc, ArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
unsigned SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new", "[", and "]" tokens in operator new [].
This file defines the classes used to store parsed information about declaration-specifiers and decla...
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
const Expr * getExpr() const
static const TST TST_decimal64
Defines the clang::TypeLoc interface and its subclasses.
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed...
SourceLocation Loc
Loc - The place where this type was defined.
SourceLocation getEnd() const
bool SetTypeSpecSign(TSS S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_half
Wraps an identifier and optional source location for the identifier.
static bool BadSpecifier(T TNew, T TPrev, const char *&PrevSpec, unsigned &DiagID, bool IsExtension=true)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
bool SetTypeSpecWidth(TSW 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 ...
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
static const TST TST_char32
noexcept(expression), evals to 'false'
static const TST TST_fract
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool'...
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
static const TST TST_float16
Encodes a location in the source.
static const TST TST_auto_type
enum clang::DeclaratorChunk::@219 Kind
static const TST TST_union
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...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
AttributeFactory * QualAttrFactory
AtttibuteFactory for the MethodQualifiers.
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
static const TST TST_typeofType
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
bool isStaticMember()
Returns true if this declares a static member.
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_decltype_auto
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Dataflow Directional Tag Classes.
ConstexprSpecKind
Define the kind of constexpr specifier.
bool isValid() const
Return true if this is a valid SourceLocation object.
static std::string getName(const CallEvent &Call)
static const TST TST_decltype
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static const TST TST_auto
static const TST TST_void
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
static const TST TST_int128
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
static const TST TST_unspecified
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
static const TST TST_decimal128
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
static const TSCS TSCS___thread
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
unsigned LParenLoc
The location of the left parenthesis in the source.
bool isFunctionType() const
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
static const TST TST_typename
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
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.
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
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...
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Captures information about "declaration specifiers".
Represents a C++ struct/union/class.
static const TSCS TSCS_thread_local
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
static const TST TST_float128
internal::Matcher< NamedDecl > hasName(const std::string &Name)
Matches NamedDecl nodes that have the specified name.
static const TST TST_bool
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
SourceManager & getSourceManager() const
A template-id, e.g., f<int>.
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
Defines the clang::TargetInfo interface.
static const TST TST_atomic
static const TST TST_struct
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
A trivial tuple used to represent a source range.
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
This represents a decl that may have a name.
unsigned ExceptionSpecLocEnd
The end location of the exception specification, if any.
Represents a C++ namespace alias.
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
static const TSCS TSCS__Thread_local
AttributePool & getAttributePool() const
SourceLocation getBegin() const
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedAttributes & getAttributes()
noexcept(expression), evals to 'true'
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?