25 #include "llvm/ADT/STLExtras.h" 26 #include "llvm/ADT/SmallString.h" 28 using namespace clang;
32 assert(TemplateId &&
"NULL template-id annotation?");
40 assert(TemplateId &&
"NULL template-id annotation?");
49 Builder.Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
50 if (Range.getBegin().isInvalid())
52 Range.setEnd(ColonColonLoc);
54 assert(Range == Builder.getSourceRange() &&
55 "NestedNameSpecifierLoc range computation incorrect");
61 Builder.Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
63 if (Range.getBegin().isInvalid())
64 Range.setBegin(IdentifierLoc);
65 Range.setEnd(ColonColonLoc);
67 assert(Range == Builder.getSourceRange() &&
68 "NestedNameSpecifierLoc range computation incorrect");
74 Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
76 if (Range.getBegin().isInvalid())
77 Range.setBegin(NamespaceLoc);
78 Range.setEnd(ColonColonLoc);
80 assert(Range == Builder.getSourceRange() &&
81 "NestedNameSpecifierLoc range computation incorrect");
87 Builder.Extend(Context, Alias, AliasLoc, ColonColonLoc);
89 if (Range.getBegin().isInvalid())
90 Range.setBegin(AliasLoc);
91 Range.setEnd(ColonColonLoc);
93 assert(Range == Builder.getSourceRange() &&
94 "NestedNameSpecifierLoc range computation incorrect");
99 Builder.MakeGlobal(Context, ColonColonLoc);
103 assert(Range == Builder.getSourceRange() &&
104 "NestedNameSpecifierLoc range computation incorrect");
110 Builder.MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
112 Range.setBegin(SuperLoc);
113 Range.setEnd(ColonColonLoc);
115 assert(Range == Builder.getSourceRange() &&
116 "NestedNameSpecifierLoc range computation incorrect");
121 Builder.MakeTrivial(Context, Qualifier, R);
133 Builder.Adopt(Other);
137 if (!Builder.getRepresentation())
139 return Builder.getTemporary().getLocalBeginLoc();
144 if (!Builder.getRepresentation())
147 return Builder.getWithLocInContext(Context);
159 bool RefQualifierIsLvalueRef,
167 unsigned NumExceptions,
178 "function cannot have _Atomic qualifier");
182 I.
Loc = LocalRangeBegin;
228 if (!TheDeclarator.InlineStorageUsed &&
229 NumParams <= llvm::array_lengthof(TheDeclarator.
InlineParams)) {
233 TheDeclarator.InlineStorageUsed =
true;
238 for (
unsigned i = 0; i < NumParams; i++)
250 for (
unsigned i = 0; i != NumExceptions; ++i) {
268 if (!DeclsInPrototype.empty()) {
269 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
270 "cannot have exception specifiers and decls in prototype");
274 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
285 assert(!
hasName() &&
"declarator given multiple names!");
287 BindingGroup.LSquareLoc = LSquareLoc;
288 BindingGroup.RSquareLoc = RSquareLoc;
289 BindingGroup.NumBindings = Bindings.size();
290 Range.setEnd(RSquareLoc);
293 SetIdentifier(
nullptr, LSquareLoc);
294 Name.EndLocation = RSquareLoc;
297 if (Bindings.size()) {
298 if (!InlineStorageUsed &&
299 Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
300 BindingGroup.Bindings = InlineBindings;
301 BindingGroup.DeleteBindings =
false;
302 InlineStorageUsed =
true;
304 BindingGroup.Bindings =
306 BindingGroup.DeleteBindings =
true;
308 std::uninitialized_copy(Bindings.begin(), Bindings.end(),
309 BindingGroup.Bindings);
314 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
315 switch (DeclTypeInfo[i].
Kind) {
328 llvm_unreachable(
"Invalid type chunk");
331 switch (DS.getTypeSpecType()) {
362 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 363 #include "clang/Basic/OpenCLImageTypes.def" 373 if (
Expr *E = DS.getRepAsExpr())
374 return E->getType()->isFunctionType();
380 QualType QT = DS.getRepAsType().get();
384 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
394 llvm_unreachable(
"Invalid TypeSpecType!");
412 if (TypeQualifiers & TQ_const)
413 Handle(TQ_const,
"const", TQ_constLoc);
414 if (TypeQualifiers & TQ_volatile)
415 Handle(TQ_volatile,
"volatile", TQ_volatileLoc);
416 if (TypeQualifiers & TQ_restrict)
417 Handle(TQ_restrict,
"restrict", TQ_restrictLoc);
418 if (TypeQualifiers & TQ_unaligned)
419 Handle(TQ_unaligned,
"unaligned", TQ_unalignedLoc);
424 forEachCVRUQualifier(Handle);
431 return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
439 if (StorageClassSpec != SCS_unspecified ||
441 Res |= PQ_StorageClassSpecifier;
443 if (TypeQualifiers != TQ_unspecified)
444 Res |= PQ_TypeQualifier;
446 if (hasTypeSpecifier())
447 Res |= PQ_TypeSpecifier;
449 if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified ||
450 FS_noreturn_specified || FS_forceinline_specified)
451 Res |= PQ_FunctionSpecifier;
456 const char *&PrevSpec,
458 bool IsExtension =
true) {
461 DiagID = diag::err_invalid_decl_spec_combination;
463 DiagID = IsExtension ? diag::ext_warn_duplicate_declspec :
464 diag::warn_duplicate_declspec;
479 llvm_unreachable(
"Unknown typespec!");
489 llvm_unreachable(
"Unknown typespec!");
499 llvm_unreachable(
"Unknown typespec!");
504 case TSC_unspecified:
return "unspecified";
505 case TSC_imaginary:
return "imaginary";
506 case TSC_complex:
return "complex";
508 llvm_unreachable(
"Unknown typespec!");
518 llvm_unreachable(
"Unknown typespec!");
559 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 560 case DeclSpec::TST_##ImgType##_t: \ 561 return #ImgType "_t"; 562 #include "clang/Basic/OpenCLImageTypes.def" 565 llvm_unreachable(
"Unknown typespec!");
577 llvm_unreachable(
"Unknown typespec!");
581 const char *&PrevSpec,
596 case SCS_private_extern:
600 DiagID = diag::err_opencl_unknown_type_specifier;
601 PrevSpec = getSpecifierName(SC);
607 DiagID = diag::err_opencl_unknown_type_specifier;
608 PrevSpec = getSpecifierName(SC);
615 if (StorageClassSpec != SCS_unspecified) {
620 return SetTypeSpecType(
TST_auto, Loc, PrevSpec, DiagID, Policy);
621 if (StorageClassSpec == SCS_auto) {
622 isInvalid = SetTypeSpecType(
TST_auto, StorageClassSpecLoc,
623 PrevSpec, DiagID, Policy);
624 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
632 !(SCS_extern_in_linkage_spec &&
633 StorageClassSpec == SCS_extern &&
637 StorageClassSpec = SC;
638 StorageClassSpecLoc = Loc;
639 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
644 const char *&PrevSpec,
649 ThreadStorageClassSpec = TSC;
650 ThreadStorageClassSpecLoc = Loc;
658 const char *&PrevSpec,
664 TSWRange.setBegin(Loc);
670 TSWRange.setEnd(Loc);
675 const char *&PrevSpec,
677 if (TypeSpecComplex != TSC_unspecified)
685 const char *&PrevSpec,
695 const char *&PrevSpec,
699 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
704 const char *&PrevSpec,
708 assert(isTypeRep(T) &&
"T does not store a type");
709 assert(Rep &&
"no type provided!");
712 DiagID = diag::err_invalid_decl_spec_combination;
718 TSTNameLoc = TagNameLoc;
719 TypeSpecOwned =
false;
724 const char *&PrevSpec,
728 assert(isExprRep(T) &&
"T does not store an expr");
729 assert(Rep &&
"no expression provided!");
732 DiagID = diag::err_invalid_decl_spec_combination;
739 TypeSpecOwned =
false;
744 const char *&PrevSpec,
746 Decl *Rep,
bool Owned,
748 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
753 const char *&PrevSpec,
755 Decl *Rep,
bool Owned,
757 assert(isDeclRep(T) &&
"T does not store a decl");
762 DiagID = diag::err_invalid_decl_spec_combination;
768 TSTNameLoc = TagNameLoc;
769 TypeSpecOwned = Owned && Rep !=
nullptr;
774 const char *&PrevSpec,
777 assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
778 "rep required for these type-spec kinds!");
781 DiagID = diag::err_invalid_decl_spec_combination;
786 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
787 TypeAltiVecBool =
true;
791 TypeSpecOwned =
false;
799 DiagID = diag::warn_duplicate_declspec;
809 const char *&PrevSpec,
unsigned &DiagID,
813 DiagID = diag::err_invalid_vector_decl_spec_combination;
816 TypeAltiVecVector = isAltiVecVector;
822 const char *&PrevSpec,
unsigned &DiagID,
827 DiagID = diag::err_invalid_decl_spec_combination;
838 const char *&PrevSpec,
unsigned &DiagID,
840 if (!TypeAltiVecVector || TypeAltiVecPixel ||
843 DiagID = diag::err_invalid_pixel_decl_spec_combination;
846 TypeAltiVecPixel = isAltiVecPixel;
853 const char *&PrevSpec,
unsigned &DiagID,
855 if (!TypeAltiVecVector || TypeAltiVecBool ||
858 DiagID = diag::err_invalid_vector_bool_decl_spec;
861 TypeAltiVecBool = isAltiVecBool;
869 TypeSpecOwned =
false;
881 if (TypeQualifiers & T) {
882 bool IsExtension =
true;
885 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
888 return SetTypeQual(T, Loc);
895 case TQ_unspecified:
break;
896 case TQ_const: TQ_constLoc = Loc;
return false;
897 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
898 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
899 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
900 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
903 llvm_unreachable(
"Unknown type qualifier!");
910 if (FS_inline_specified) {
911 DiagID = diag::warn_duplicate_declspec;
915 FS_inline_specified =
true;
922 if (FS_forceinline_specified) {
923 DiagID = diag::warn_duplicate_declspec;
924 PrevSpec =
"__forceinline";
927 FS_forceinline_specified =
true;
928 FS_forceinlineLoc = Loc;
933 const char *&PrevSpec,
937 if (FS_virtual_specified) {
938 DiagID = diag::warn_duplicate_declspec;
939 PrevSpec =
"virtual";
942 FS_virtual_specified =
true;
948 const char *&PrevSpec,
952 if (FS_explicit_specified) {
953 DiagID = diag::warn_duplicate_declspec;
954 PrevSpec =
"explicit";
957 FS_explicit_specified =
true;
958 FS_explicitLoc = Loc;
963 const char *&PrevSpec,
967 if (FS_noreturn_specified) {
968 DiagID = diag::warn_duplicate_declspec;
969 PrevSpec =
"_Noreturn";
972 FS_noreturn_specified =
true;
973 FS_noreturnLoc = Loc;
979 if (Friend_specified) {
986 DiagID = diag::warn_duplicate_declspec;
990 Friend_specified =
true;
997 if (isModulePrivateSpecified()) {
998 PrevSpec =
"__module_private__";
999 DiagID = diag::ext_warn_duplicate_declspec;
1003 ModulePrivateLoc = Loc;
1011 if (Constexpr_specified) {
1012 DiagID = diag::warn_duplicate_declspec;
1013 PrevSpec =
"constexpr";
1016 Constexpr_specified =
true;
1021 void DeclSpec::SaveWrittenBuiltinSpecs() {
1022 writtenBS.Sign = getTypeSpecSign();
1023 writtenBS.Width = getTypeSpecWidth();
1024 writtenBS.Type = getTypeSpecType();
1026 writtenBS.ModeAttr = getAttributes().hasAttribute(ParsedAttr::AT_Mode);
1035 SaveWrittenBuiltinSpecs();
1042 TypeSpecComplex != TSC_unspecified ||
1044 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1046 const unsigned NumLocs = 9;
1048 TSWRange.getBegin(), TSCLoc, TSSLoc,
1049 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1050 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1053 for (
unsigned I = 0; I != NumLocs; ++I) {
1058 FirstLoc = ExtraLocs[I];
1063 TypeSpecComplex = TSC_unspecified;
1065 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1067 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1068 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1069 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1073 if (TypeAltiVecVector) {
1074 if (TypeAltiVecBool) {
1077 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1078 << getSpecifierName((
TSS)TypeSpecSign);
1083 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1084 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1085 << (TypeAltiVecPixel ?
"__pixel" :
1086 getSpecifierName((
TST)TypeSpecType, Policy));
1092 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1093 << getSpecifierName((
TSW)TypeSpecWidth);
1100 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1110 S.
Diag(TSWRange.getBegin(),
1111 diag::err_invalid_vector_long_double_decl_spec);
1114 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1120 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1121 }
else if (TypeSpecWidth ==
TSW_long) {
1124 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1126 S.
Diag(TSWRange.getBegin(),
1127 diag::warn_vector_long_decl_spec_combination)
1128 << getSpecifierName((
TST)TypeSpecType, Policy);
1131 if (TypeAltiVecPixel) {
1136 TypeSpecOwned =
false;
1140 bool IsFixedPointType =
1141 TypeSpecType == TST_accum || TypeSpecType == TST_fract;
1149 !IsFixedPointType) {
1150 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1151 << getSpecifierName((
TST)TypeSpecType, Policy);
1158 switch (TypeSpecWidth) {
1164 else if (!(TypeSpecType ==
TST_int ||
1165 (IsFixedPointType && TypeSpecWidth !=
TSW_longlong))) {
1166 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1167 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1169 TypeSpecSat =
false;
1170 TypeSpecOwned =
false;
1177 !IsFixedPointType) {
1178 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1179 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1181 TypeSpecSat =
false;
1182 TypeSpecOwned =
false;
1189 if (TypeSpecComplex != TSC_unspecified) {
1191 S.
Diag(TSCLoc, diag::ext_plain_complex)
1199 S.
Diag(TSTLoc, diag::ext_integer_complex);
1201 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1202 << getSpecifierName((
TST)TypeSpecType, Policy);
1203 TypeSpecComplex = TSC_unspecified;
1211 switch (StorageClassSpec) {
1212 case SCS_unspecified:
1214 case SCS_private_extern:
1219 getThreadStorageClassSpecLoc(), getStorageClassSpecLoc()))
1220 S.
Diag(getStorageClassSpecLoc(),
1221 diag::err_invalid_decl_spec_combination)
1225 S.
Diag(getThreadStorageClassSpecLoc(),
1226 diag::err_invalid_decl_spec_combination)
1242 StorageClassSpec = SCS_unspecified;
1243 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1249 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1251 StorageClassSpec == SCS_auto)
1252 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1255 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1257 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1258 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1259 if (Constexpr_specified)
1260 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1265 if (isFriendSpecified() &&
1266 (getStorageClassSpec() || getThreadStorageClassSpec())) {
1272 SpecName = getSpecifierName(SC);
1273 SCLoc = getStorageClassSpecLoc();
1278 if (!SpecName.empty()) SpecName +=
" ";
1279 SpecName += getSpecifierName(
TSC);
1280 SCLoc = getThreadStorageClassSpecLoc();
1284 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1285 << SpecName << StorageHint << ThreadHint;
1287 ClearStorageClassSpecs();
1297 if (isFriendSpecified() && (isVirtualSpecified() || isExplicitSpecified())) {
1301 if (isVirtualSpecified()) {
1302 Keyword =
"virtual";
1303 SCLoc = getVirtualSpecLoc();
1305 Keyword =
"explicit";
1306 SCLoc = getExplicitSpecLoc();
1310 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1313 FS_virtual_specified = FS_explicit_specified =
false;
1317 assert(!TypeSpecOwned || isDeclRep((
TST) TypeSpecType));
1327 TST tst = getTypeSpecType();
1328 return isDeclRep(tst) && getRepAsDecl() !=
nullptr &&
1339 for (
unsigned I = 0; I != 3; ++I) {
1342 if (SymbolLocations[I].
isValid())
1348 const char *&PrevSpec) {
1349 if (!FirstLocation.isValid())
1350 FirstLocation = Loc;
1354 if (Specifiers & VS) {
1355 PrevSpec = getSpecifierName(VS);
1362 default: llvm_unreachable(
"Unknown specifier!");
1363 case VS_Override: VS_overrideLoc = Loc;
break;
1366 case VS_Final: VS_finalLoc = Loc;
break;
1374 default: llvm_unreachable(
"Unknown specifier");
1375 case VS_Override:
return "override";
1376 case VS_Final:
return "final";
1377 case VS_GNU_Final:
return "__final";
1378 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.
bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
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.
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)
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.
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
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()
noexcept(expression), value-dependent
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
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
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.
enum clang::DeclaratorChunk::@215 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(), 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...
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.
bool isValid() const
Return true if this is a valid SourceLocation object.
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?