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!");
573 llvm_unreachable(
"Unknown ConstexprSpecKind");
585 llvm_unreachable(
"Unknown typespec!");
589 const char *&PrevSpec,
603 case SCS_private_extern:
607 DiagID = diag::err_opencl_unknown_type_specifier;
608 PrevSpec = getSpecifierName(SC);
614 DiagID = diag::err_opencl_unknown_type_specifier;
615 PrevSpec = getSpecifierName(SC);
622 if (StorageClassSpec != SCS_unspecified) {
627 return SetTypeSpecType(
TST_auto, Loc, PrevSpec, DiagID, Policy);
628 if (StorageClassSpec == SCS_auto) {
629 isInvalid = SetTypeSpecType(
TST_auto, StorageClassSpecLoc,
630 PrevSpec, DiagID, Policy);
631 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
639 !(SCS_extern_in_linkage_spec &&
640 StorageClassSpec == SCS_extern &&
644 StorageClassSpec = SC;
645 StorageClassSpecLoc = Loc;
646 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
651 const char *&PrevSpec,
656 ThreadStorageClassSpec = TSC;
657 ThreadStorageClassSpecLoc = Loc;
665 const char *&PrevSpec,
671 TSWRange.setBegin(Loc);
677 TSWRange.setEnd(Loc);
682 const char *&PrevSpec,
684 if (TypeSpecComplex != TSC_unspecified)
692 const char *&PrevSpec,
702 const char *&PrevSpec,
706 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
711 const char *&PrevSpec,
715 assert(isTypeRep(T) &&
"T does not store a type");
716 assert(Rep &&
"no type provided!");
721 DiagID = diag::err_invalid_decl_spec_combination;
727 TSTNameLoc = TagNameLoc;
728 TypeSpecOwned =
false;
733 const char *&PrevSpec,
737 assert(isExprRep(T) &&
"T does not store an expr");
738 assert(Rep &&
"no expression provided!");
743 DiagID = diag::err_invalid_decl_spec_combination;
750 TypeSpecOwned =
false;
755 const char *&PrevSpec,
757 Decl *Rep,
bool Owned,
759 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
764 const char *&PrevSpec,
766 Decl *Rep,
bool Owned,
768 assert(isDeclRep(T) &&
"T does not store a decl");
775 DiagID = diag::err_invalid_decl_spec_combination;
781 TSTNameLoc = TagNameLoc;
782 TypeSpecOwned = Owned && Rep !=
nullptr;
787 const char *&PrevSpec,
790 assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
791 "rep required for these type-spec kinds!");
796 DiagID = diag::err_invalid_decl_spec_combination;
801 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
802 TypeAltiVecBool =
true;
806 TypeSpecOwned =
false;
814 DiagID = diag::warn_duplicate_declspec;
824 const char *&PrevSpec,
unsigned &DiagID,
830 DiagID = diag::err_invalid_vector_decl_spec_combination;
833 TypeAltiVecVector = isAltiVecVector;
839 const char *&PrevSpec,
unsigned &DiagID,
845 DiagID = diag::err_invalid_decl_spec_combination;
856 const char *&PrevSpec,
unsigned &DiagID,
860 if (!TypeAltiVecVector || TypeAltiVecPixel ||
863 DiagID = diag::err_invalid_pixel_decl_spec_combination;
866 TypeAltiVecPixel = isAltiVecPixel;
873 const char *&PrevSpec,
unsigned &DiagID,
877 if (!TypeAltiVecVector || TypeAltiVecBool ||
880 DiagID = diag::err_invalid_vector_bool_decl_spec;
883 TypeAltiVecBool = isAltiVecBool;
891 TypeSpecOwned =
false;
903 if (TypeQualifiers & T) {
904 bool IsExtension =
true;
907 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
910 return SetTypeQual(T, Loc);
917 case TQ_unspecified:
break;
918 case TQ_const: TQ_constLoc = Loc;
return false;
919 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
920 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
921 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
922 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
925 llvm_unreachable(
"Unknown type qualifier!");
932 if (FS_inline_specified) {
933 DiagID = diag::warn_duplicate_declspec;
937 FS_inline_specified =
true;
944 if (FS_forceinline_specified) {
945 DiagID = diag::warn_duplicate_declspec;
946 PrevSpec =
"__forceinline";
949 FS_forceinline_specified =
true;
950 FS_forceinlineLoc = Loc;
955 const char *&PrevSpec,
959 if (FS_virtual_specified) {
960 DiagID = diag::warn_duplicate_declspec;
961 PrevSpec =
"virtual";
964 FS_virtual_specified =
true;
970 const char *&PrevSpec,
unsigned &DiagID,
975 "invalid ExplicitSpecifier");
978 if (hasExplicitSpecifier()) {
979 DiagID = (ExplicitSpec.
getExpr() || FS_explicit_specifier.getExpr())
980 ? diag::err_duplicate_declspec
981 : diag::ext_warn_duplicate_declspec;
982 PrevSpec =
"explicit";
985 FS_explicit_specifier = ExplicitSpec;
986 FS_explicitLoc = Loc;
987 FS_explicitCloseParenLoc = CloseParenLoc;
992 const char *&PrevSpec,
996 if (FS_noreturn_specified) {
997 DiagID = diag::warn_duplicate_declspec;
998 PrevSpec =
"_Noreturn";
1001 FS_noreturn_specified =
true;
1002 FS_noreturnLoc = Loc;
1008 if (Friend_specified) {
1009 PrevSpec =
"friend";
1015 DiagID = diag::warn_duplicate_declspec;
1019 Friend_specified =
true;
1026 if (isModulePrivateSpecified()) {
1027 PrevSpec =
"__module_private__";
1028 DiagID = diag::ext_warn_duplicate_declspec;
1032 ModulePrivateLoc = Loc;
1041 return BadSpecifier(ConstexprKind, getConstexprSpecifier(), PrevSpec, DiagID);
1042 DiagID = diag::warn_duplicate_declspec;
1043 PrevSpec =
"constexpr";
1046 ConstexprSpecifier = ConstexprKind;
1051 void DeclSpec::SaveWrittenBuiltinSpecs() {
1052 writtenBS.Sign = getTypeSpecSign();
1053 writtenBS.Width = getTypeSpecWidth();
1054 writtenBS.Type = getTypeSpecType();
1056 writtenBS.ModeAttr = getAttributes().hasAttribute(ParsedAttr::AT_Mode);
1065 SaveWrittenBuiltinSpecs();
1075 TypeSpecComplex != TSC_unspecified ||
1077 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1079 const unsigned NumLocs = 9;
1081 TSWRange.getBegin(), TSCLoc, TSSLoc,
1082 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1083 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1086 for (
unsigned I = 0; I != NumLocs; ++I) {
1091 FirstLoc = ExtraLocs[I];
1096 TypeSpecComplex = TSC_unspecified;
1098 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1100 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1101 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1102 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1106 if (TypeAltiVecVector) {
1107 if (TypeAltiVecBool) {
1110 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1111 << getSpecifierName((
TSS)TypeSpecSign);
1116 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1117 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1118 << (TypeAltiVecPixel ?
"__pixel" :
1119 getSpecifierName((
TST)TypeSpecType, Policy));
1125 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1126 << getSpecifierName((
TSW)TypeSpecWidth);
1133 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1143 S.
Diag(TSWRange.getBegin(),
1144 diag::err_invalid_vector_long_double_decl_spec);
1147 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1153 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1154 }
else if (TypeSpecWidth ==
TSW_long) {
1157 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1159 S.
Diag(TSWRange.getBegin(),
1160 diag::warn_vector_long_decl_spec_combination)
1161 << getSpecifierName((
TST)TypeSpecType, Policy);
1164 if (TypeAltiVecPixel) {
1169 TypeSpecOwned =
false;
1173 bool IsFixedPointType =
1174 TypeSpecType == TST_accum || TypeSpecType == TST_fract;
1182 !IsFixedPointType) {
1183 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1184 << getSpecifierName((
TST)TypeSpecType, Policy);
1191 switch (TypeSpecWidth) {
1197 else if (!(TypeSpecType ==
TST_int ||
1198 (IsFixedPointType && TypeSpecWidth !=
TSW_longlong))) {
1199 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1200 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1202 TypeSpecSat =
false;
1203 TypeSpecOwned =
false;
1210 !IsFixedPointType) {
1211 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1212 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1214 TypeSpecSat =
false;
1215 TypeSpecOwned =
false;
1222 if (TypeSpecComplex != TSC_unspecified) {
1224 S.
Diag(TSCLoc, diag::ext_plain_complex)
1232 S.
Diag(TSTLoc, diag::ext_integer_complex);
1234 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1235 << getSpecifierName((
TST)TypeSpecType, Policy);
1236 TypeSpecComplex = TSC_unspecified;
1244 switch (StorageClassSpec) {
1245 case SCS_unspecified:
1247 case SCS_private_extern:
1252 getThreadStorageClassSpecLoc(), getStorageClassSpecLoc()))
1253 S.
Diag(getStorageClassSpecLoc(),
1254 diag::err_invalid_decl_spec_combination)
1258 S.
Diag(getThreadStorageClassSpecLoc(),
1259 diag::err_invalid_decl_spec_combination)
1275 StorageClassSpec = SCS_unspecified;
1276 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1282 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1284 StorageClassSpec == SCS_auto)
1285 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1288 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1290 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1291 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1293 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1295 S.
Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
1299 if (isFriendSpecified() &&
1300 (getStorageClassSpec() || getThreadStorageClassSpec())) {
1306 SpecName = getSpecifierName(SC);
1307 SCLoc = getStorageClassSpecLoc();
1312 if (!SpecName.empty()) SpecName +=
" ";
1313 SpecName += getSpecifierName(
TSC);
1314 SCLoc = getThreadStorageClassSpecLoc();
1318 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1319 << SpecName << StorageHint << ThreadHint;
1321 ClearStorageClassSpecs();
1331 if (isFriendSpecified() && (isVirtualSpecified() || hasExplicitSpecifier())) {
1336 if (isVirtualSpecified()) {
1337 Keyword =
"virtual";
1338 SCLoc = getVirtualSpecLoc();
1341 Keyword =
"explicit";
1342 SCLoc = getExplicitSpecLoc();
1346 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1349 FS_virtual_specified =
false;
1354 assert(!TypeSpecOwned || isDeclRep((
TST) TypeSpecType));
1364 TST tst = getTypeSpecType();
1365 return isDeclRep(tst) && getRepAsDecl() !=
nullptr &&
1376 for (
unsigned I = 0; I != 3; ++I) {
1379 if (SymbolLocations[I].
isValid())
1385 const char *&PrevSpec) {
1386 if (!FirstLocation.isValid())
1387 FirstLocation = Loc;
1391 if (Specifiers & VS) {
1392 PrevSpec = getSpecifierName(VS);
1399 default: llvm_unreachable(
"Unknown specifier!");
1400 case VS_Override: VS_overrideLoc = Loc;
break;
1403 case VS_Final: VS_finalLoc = Loc;
break;
1411 default: llvm_unreachable(
"Unknown specifier");
1412 case VS_Override:
return "override";
1413 case VS_Final:
return "final";
1414 case VS_GNU_Final:
return "__final";
1415 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
enum clang::DeclaratorChunk::@217 Kind
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
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?