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);
160 bool RefQualifierIsLvalueRef,
164 VolatileQualifierLoc,
166 RestrictQualifierLoc,
173 unsigned NumExceptions,
183 "function cannot have _Atomic qualifier");
187 I.
Loc = LocalRangeBegin;
215 assert(I.
Fun.
TypeQuals == TypeQuals &&
"bitfield overflow");
224 if (!TheDeclarator.InlineStorageUsed &&
225 NumParams <= llvm::array_lengthof(TheDeclarator.
InlineParams)) {
229 TheDeclarator.InlineStorageUsed =
true;
234 for (
unsigned i = 0; i < NumParams; i++)
246 for (
unsigned i = 0; i != NumExceptions; ++i) {
264 if (!DeclsInPrototype.empty()) {
265 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
266 "cannot have exception specifiers and decls in prototype");
270 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
281 assert(!
hasName() &&
"declarator given multiple names!");
283 BindingGroup.LSquareLoc = LSquareLoc;
284 BindingGroup.RSquareLoc = RSquareLoc;
285 BindingGroup.NumBindings = Bindings.size();
286 Range.setEnd(RSquareLoc);
289 SetIdentifier(
nullptr, LSquareLoc);
290 Name.EndLocation = RSquareLoc;
293 if (Bindings.size()) {
294 if (!InlineStorageUsed &&
295 Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
296 BindingGroup.Bindings = InlineBindings;
297 BindingGroup.DeleteBindings =
false;
298 InlineStorageUsed =
true;
300 BindingGroup.Bindings =
302 BindingGroup.DeleteBindings =
true;
304 std::uninitialized_copy(Bindings.begin(), Bindings.end(),
305 BindingGroup.Bindings);
310 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
311 switch (DeclTypeInfo[i].
Kind) {
324 llvm_unreachable(
"Invalid type chunk");
327 switch (DS.getTypeSpecType()) {
358 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 359 #include "clang/Basic/OpenCLImageTypes.def" 369 if (
Expr *E = DS.getRepAsExpr())
370 return E->getType()->isFunctionType();
376 QualType QT = DS.getRepAsType().get();
380 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
390 llvm_unreachable(
"Invalid TypeSpecType!");
409 return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
417 if (StorageClassSpec != SCS_unspecified ||
419 Res |= PQ_StorageClassSpecifier;
421 if (TypeQualifiers != TQ_unspecified)
422 Res |= PQ_TypeQualifier;
424 if (hasTypeSpecifier())
425 Res |= PQ_TypeSpecifier;
427 if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified ||
428 FS_noreturn_specified || FS_forceinline_specified)
429 Res |= PQ_FunctionSpecifier;
434 const char *&PrevSpec,
436 bool IsExtension =
true) {
439 DiagID = diag::err_invalid_decl_spec_combination;
441 DiagID = IsExtension ? diag::ext_duplicate_declspec :
442 diag::warn_duplicate_declspec;
457 llvm_unreachable(
"Unknown typespec!");
467 llvm_unreachable(
"Unknown typespec!");
477 llvm_unreachable(
"Unknown typespec!");
482 case TSC_unspecified:
return "unspecified";
483 case TSC_imaginary:
return "imaginary";
484 case TSC_complex:
return "complex";
486 llvm_unreachable(
"Unknown typespec!");
496 llvm_unreachable(
"Unknown typespec!");
537 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 538 case DeclSpec::TST_##ImgType##_t: \ 539 return #ImgType "_t"; 540 #include "clang/Basic/OpenCLImageTypes.def" 543 llvm_unreachable(
"Unknown typespec!");
555 llvm_unreachable(
"Unknown typespec!");
559 const char *&PrevSpec,
573 case SCS_private_extern:
576 DiagID = diag::err_opencl_unknown_type_specifier;
577 PrevSpec = getSpecifierName(SC);
583 DiagID = diag::err_opencl_unknown_type_specifier;
584 PrevSpec = getSpecifierName(SC);
591 if (StorageClassSpec != SCS_unspecified) {
596 return SetTypeSpecType(
TST_auto, Loc, PrevSpec, DiagID, Policy);
597 if (StorageClassSpec == SCS_auto) {
598 isInvalid = SetTypeSpecType(
TST_auto, StorageClassSpecLoc,
599 PrevSpec, DiagID, Policy);
600 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
608 !(SCS_extern_in_linkage_spec &&
609 StorageClassSpec == SCS_extern &&
613 StorageClassSpec = SC;
614 StorageClassSpecLoc = Loc;
615 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
620 const char *&PrevSpec,
625 ThreadStorageClassSpec = TSC;
626 ThreadStorageClassSpecLoc = Loc;
634 const char *&PrevSpec,
640 TSWRange.setBegin(Loc);
646 TSWRange.setEnd(Loc);
651 const char *&PrevSpec,
653 if (TypeSpecComplex != TSC_unspecified)
661 const char *&PrevSpec,
671 const char *&PrevSpec,
675 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
680 const char *&PrevSpec,
684 assert(isTypeRep(T) &&
"T does not store a type");
685 assert(Rep &&
"no type provided!");
688 DiagID = diag::err_invalid_decl_spec_combination;
694 TSTNameLoc = TagNameLoc;
695 TypeSpecOwned =
false;
700 const char *&PrevSpec,
704 assert(isExprRep(T) &&
"T does not store an expr");
705 assert(Rep &&
"no expression provided!");
708 DiagID = diag::err_invalid_decl_spec_combination;
715 TypeSpecOwned =
false;
720 const char *&PrevSpec,
722 Decl *Rep,
bool Owned,
724 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
729 const char *&PrevSpec,
731 Decl *Rep,
bool Owned,
733 assert(isDeclRep(T) &&
"T does not store a decl");
738 DiagID = diag::err_invalid_decl_spec_combination;
744 TSTNameLoc = TagNameLoc;
745 TypeSpecOwned = Owned && Rep !=
nullptr;
750 const char *&PrevSpec,
753 assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
754 "rep required for these type-spec kinds!");
757 DiagID = diag::err_invalid_decl_spec_combination;
762 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
763 TypeAltiVecBool =
true;
767 TypeSpecOwned =
false;
775 DiagID = diag::warn_duplicate_declspec;
785 const char *&PrevSpec,
unsigned &DiagID,
789 DiagID = diag::err_invalid_vector_decl_spec_combination;
792 TypeAltiVecVector = isAltiVecVector;
798 const char *&PrevSpec,
unsigned &DiagID,
803 DiagID = diag::err_invalid_decl_spec_combination;
814 const char *&PrevSpec,
unsigned &DiagID,
816 if (!TypeAltiVecVector || TypeAltiVecPixel ||
819 DiagID = diag::err_invalid_pixel_decl_spec_combination;
822 TypeAltiVecPixel = isAltiVecPixel;
829 const char *&PrevSpec,
unsigned &DiagID,
831 if (!TypeAltiVecVector || TypeAltiVecBool ||
834 DiagID = diag::err_invalid_vector_bool_decl_spec;
837 TypeAltiVecBool = isAltiVecBool;
845 TypeSpecOwned =
false;
857 if (TypeQualifiers & T) {
858 bool IsExtension =
true;
861 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
866 case TQ_unspecified:
break;
867 case TQ_const: TQ_constLoc = Loc;
return false;
868 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
869 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
870 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
871 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
874 llvm_unreachable(
"Unknown type qualifier!");
881 if (FS_inline_specified) {
882 DiagID = diag::warn_duplicate_declspec;
886 FS_inline_specified =
true;
893 if (FS_forceinline_specified) {
894 DiagID = diag::warn_duplicate_declspec;
895 PrevSpec =
"__forceinline";
898 FS_forceinline_specified =
true;
899 FS_forceinlineLoc = Loc;
904 const char *&PrevSpec,
908 if (FS_virtual_specified) {
909 DiagID = diag::warn_duplicate_declspec;
910 PrevSpec =
"virtual";
913 FS_virtual_specified =
true;
919 const char *&PrevSpec,
923 if (FS_explicit_specified) {
924 DiagID = diag::warn_duplicate_declspec;
925 PrevSpec =
"explicit";
928 FS_explicit_specified =
true;
929 FS_explicitLoc = Loc;
934 const char *&PrevSpec,
938 if (FS_noreturn_specified) {
939 DiagID = diag::warn_duplicate_declspec;
940 PrevSpec =
"_Noreturn";
943 FS_noreturn_specified =
true;
944 FS_noreturnLoc = Loc;
950 if (Friend_specified) {
957 DiagID = diag::warn_duplicate_declspec;
961 Friend_specified =
true;
968 if (isModulePrivateSpecified()) {
969 PrevSpec =
"__module_private__";
970 DiagID = diag::ext_duplicate_declspec;
974 ModulePrivateLoc = Loc;
982 if (Constexpr_specified) {
983 DiagID = diag::warn_duplicate_declspec;
984 PrevSpec =
"constexpr";
987 Constexpr_specified =
true;
992 void DeclSpec::SaveWrittenBuiltinSpecs() {
993 writtenBS.Sign = getTypeSpecSign();
994 writtenBS.Width = getTypeSpecWidth();
995 writtenBS.Type = getTypeSpecType();
997 writtenBS.ModeAttr = getAttributes().hasAttribute(ParsedAttr::AT_Mode);
1006 SaveWrittenBuiltinSpecs();
1013 TypeSpecComplex != TSC_unspecified ||
1015 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1017 const unsigned NumLocs = 9;
1019 TSWRange.getBegin(), TSCLoc, TSSLoc,
1020 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1021 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1024 for (
unsigned I = 0; I != NumLocs; ++I) {
1029 FirstLoc = ExtraLocs[I];
1034 TypeSpecComplex = TSC_unspecified;
1036 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1038 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1039 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1040 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1044 if (TypeAltiVecVector) {
1045 if (TypeAltiVecBool) {
1048 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1049 << getSpecifierName((
TSS)TypeSpecSign);
1054 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1055 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1056 << (TypeAltiVecPixel ?
"__pixel" :
1057 getSpecifierName((
TST)TypeSpecType, Policy));
1063 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1064 << getSpecifierName((
TSW)TypeSpecWidth);
1071 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1081 S.
Diag(TSWRange.getBegin(),
1082 diag::err_invalid_vector_long_double_decl_spec);
1085 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1091 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1092 }
else if (TypeSpecWidth ==
TSW_long) {
1095 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1097 S.
Diag(TSWRange.getBegin(),
1098 diag::warn_vector_long_decl_spec_combination)
1099 << getSpecifierName((
TST)TypeSpecType, Policy);
1102 if (TypeAltiVecPixel) {
1107 TypeSpecOwned =
false;
1111 bool IsFixedPointType =
1112 TypeSpecType == TST_accum || TypeSpecType == TST_fract;
1120 !IsFixedPointType) {
1121 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1122 << getSpecifierName((
TST)TypeSpecType, Policy);
1129 switch (TypeSpecWidth) {
1135 else if (!(TypeSpecType ==
TST_int ||
1136 (IsFixedPointType && TypeSpecWidth !=
TSW_longlong))) {
1137 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1138 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1140 TypeSpecSat =
false;
1141 TypeSpecOwned =
false;
1148 !IsFixedPointType) {
1149 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1150 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1152 TypeSpecSat =
false;
1153 TypeSpecOwned =
false;
1160 if (TypeSpecComplex != TSC_unspecified) {
1162 S.
Diag(TSCLoc, diag::ext_plain_complex)
1170 S.
Diag(TSTLoc, diag::ext_integer_complex);
1172 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1173 << getSpecifierName((
TST)TypeSpecType, Policy);
1174 TypeSpecComplex = TSC_unspecified;
1182 switch (StorageClassSpec) {
1183 case SCS_unspecified:
1185 case SCS_private_extern:
1190 getThreadStorageClassSpecLoc(), getStorageClassSpecLoc()))
1191 S.
Diag(getStorageClassSpecLoc(),
1192 diag::err_invalid_decl_spec_combination)
1196 S.
Diag(getThreadStorageClassSpecLoc(),
1197 diag::err_invalid_decl_spec_combination)
1213 StorageClassSpec = SCS_unspecified;
1214 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1220 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1222 StorageClassSpec == SCS_auto)
1223 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1226 S.
Diag(TSTLoc, diag::warn_cxx17_compat_unicode_type);
1228 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1229 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1230 if (Constexpr_specified)
1231 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1236 if (isFriendSpecified() &&
1237 (getStorageClassSpec() || getThreadStorageClassSpec())) {
1243 SpecName = getSpecifierName(SC);
1244 SCLoc = getStorageClassSpecLoc();
1249 if (!SpecName.empty()) SpecName +=
" ";
1250 SpecName += getSpecifierName(
TSC);
1251 SCLoc = getThreadStorageClassSpecLoc();
1255 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1256 << SpecName << StorageHint << ThreadHint;
1258 ClearStorageClassSpecs();
1268 if (isFriendSpecified() && (isVirtualSpecified() || isExplicitSpecified())) {
1272 if (isVirtualSpecified()) {
1273 Keyword =
"virtual";
1274 SCLoc = getVirtualSpecLoc();
1276 Keyword =
"explicit";
1277 SCLoc = getExplicitSpecLoc();
1281 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1284 FS_virtual_specified = FS_explicit_specified =
false;
1288 assert(!TypeSpecOwned || isDeclRep((
TST) TypeSpecType));
1298 TST tst = getTypeSpecType();
1299 return isDeclRep(tst) && getRepAsDecl() !=
nullptr &&
1310 for (
unsigned I = 0; I != 3; ++I) {
1313 if (SymbolLocations[I].
isValid())
1319 const char *&PrevSpec) {
1320 if (!FirstLocation.isValid())
1321 FirstLocation = Loc;
1325 if (Specifiers & VS) {
1326 PrevSpec = getSpecifierName(VS);
1333 default: llvm_unreachable(
"Unknown specifier!");
1334 case VS_Override: VS_overrideLoc = Loc;
break;
1337 case VS_Final: VS_finalLoc = Loc;
break;
1345 default: llvm_unreachable(
"Unknown specifier");
1346 case VS_Override:
return "override";
1347 case VS_Final:
return "final";
1348 case VS_GNU_Final:
return "__final";
1349 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.
unsigned RestrictQualifierLoc
The location of the restrict-qualifier, if any.
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.
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.
unsigned VolatileQualifierLoc
The location of the volatile-qualifier, if any.
static const TST TST_class
OverloadedOperatorKind Operator
The kind of overloaded operator.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned The qualifier bitmask values are the same as...
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
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.
enum clang::DeclaratorChunk::@196 Kind
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.
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...
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.
Expr - 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.
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, unsigned TypeQuals, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation ConstQualifierLoc, SourceLocation VolatileQualifierLoc, SourceLocation RestrictQualifierLoc, 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())
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
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>::".
static const TST TST_typeofType
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const LangOptions &Lang)
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.
unsigned ConstQualifierLoc
The location of the const-qualifier, if any.
static const TST TST_unspecified
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
static const TST TST_decimal128
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.
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
SourceLocation getBegin() const
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
noexcept(expression), evals to 'true'
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?