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;
216 assert(I.
Fun.
TypeQuals == TypeQuals &&
"bitfield overflow");
225 if (!TheDeclarator.InlineStorageUsed &&
226 NumParams <= llvm::array_lengthof(TheDeclarator.
InlineParams)) {
230 TheDeclarator.InlineStorageUsed =
true;
235 for (
unsigned i = 0; i < NumParams; i++)
247 for (
unsigned i = 0; i != NumExceptions; ++i) {
263 if (!DeclsInPrototype.empty()) {
264 assert(ESpecType ==
EST_None && NumExceptions == 0 &&
265 "cannot have exception specifiers and decls in prototype");
269 for (
size_t J = 0; J < DeclsInPrototype.size(); ++J)
280 assert(!
hasName() &&
"declarator given multiple names!");
282 BindingGroup.LSquareLoc = LSquareLoc;
283 BindingGroup.RSquareLoc = RSquareLoc;
284 BindingGroup.NumBindings = Bindings.size();
285 Range.setEnd(RSquareLoc);
288 SetIdentifier(
nullptr, LSquareLoc);
289 Name.EndLocation = RSquareLoc;
292 if (Bindings.size()) {
293 if (!InlineStorageUsed &&
294 Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
295 BindingGroup.Bindings = InlineBindings;
296 BindingGroup.DeleteBindings =
false;
297 InlineStorageUsed =
true;
299 BindingGroup.Bindings =
301 BindingGroup.DeleteBindings =
true;
303 std::uninitialized_copy(Bindings.begin(), Bindings.end(),
304 BindingGroup.Bindings);
309 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
310 switch (DeclTypeInfo[i].
Kind) {
323 llvm_unreachable(
"Invalid type chunk");
326 switch (DS.getTypeSpecType()) {
354 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: 355 #include "clang/Basic/OpenCLImageTypes.def" 365 if (
Expr *E = DS.getRepAsExpr())
366 return E->getType()->isFunctionType();
372 QualType QT = DS.getRepAsType().get();
376 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
386 llvm_unreachable(
"Invalid TypeSpecType!");
405 return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
413 if (StorageClassSpec != SCS_unspecified ||
415 Res |= PQ_StorageClassSpecifier;
417 if (TypeQualifiers != TQ_unspecified)
418 Res |= PQ_TypeQualifier;
420 if (hasTypeSpecifier())
421 Res |= PQ_TypeSpecifier;
423 if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified ||
424 FS_noreturn_specified || FS_forceinline_specified)
425 Res |= PQ_FunctionSpecifier;
430 const char *&PrevSpec,
432 bool IsExtension =
true) {
435 DiagID = diag::err_invalid_decl_spec_combination;
437 DiagID = IsExtension ? diag::ext_duplicate_declspec :
438 diag::warn_duplicate_declspec;
453 llvm_unreachable(
"Unknown typespec!");
463 llvm_unreachable(
"Unknown typespec!");
473 llvm_unreachable(
"Unknown typespec!");
478 case TSC_unspecified:
return "unspecified";
479 case TSC_imaginary:
return "imaginary";
480 case TSC_complex:
return "complex";
482 llvm_unreachable(
"Unknown typespec!");
492 llvm_unreachable(
"Unknown typespec!");
530 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 531 case DeclSpec::TST_##ImgType##_t: \ 532 return #ImgType "_t"; 533 #include "clang/Basic/OpenCLImageTypes.def" 536 llvm_unreachable(
"Unknown typespec!");
548 llvm_unreachable(
"Unknown typespec!");
552 const char *&PrevSpec,
566 case SCS_private_extern:
569 DiagID = diag::err_opencl_unknown_type_specifier;
570 PrevSpec = getSpecifierName(SC);
576 DiagID = diag::err_opencl_unknown_type_specifier;
577 PrevSpec = getSpecifierName(SC);
584 if (StorageClassSpec != SCS_unspecified) {
589 return SetTypeSpecType(
TST_auto, Loc, PrevSpec, DiagID, Policy);
590 if (StorageClassSpec == SCS_auto) {
591 isInvalid = SetTypeSpecType(
TST_auto, StorageClassSpecLoc,
592 PrevSpec, DiagID, Policy);
593 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
601 !(SCS_extern_in_linkage_spec &&
602 StorageClassSpec == SCS_extern &&
606 StorageClassSpec = SC;
607 StorageClassSpecLoc = Loc;
608 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
613 const char *&PrevSpec,
618 ThreadStorageClassSpec = TSC;
619 ThreadStorageClassSpecLoc = Loc;
627 const char *&PrevSpec,
633 TSWRange.setBegin(Loc);
639 TSWRange.setEnd(Loc);
644 const char *&PrevSpec,
646 if (TypeSpecComplex != TSC_unspecified)
654 const char *&PrevSpec,
664 const char *&PrevSpec,
668 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Policy);
673 const char *&PrevSpec,
677 assert(isTypeRep(T) &&
"T does not store a type");
678 assert(Rep &&
"no type provided!");
681 DiagID = diag::err_invalid_decl_spec_combination;
687 TSTNameLoc = TagNameLoc;
688 TypeSpecOwned =
false;
693 const char *&PrevSpec,
697 assert(isExprRep(T) &&
"T does not store an expr");
698 assert(Rep &&
"no expression provided!");
701 DiagID = diag::err_invalid_decl_spec_combination;
708 TypeSpecOwned =
false;
713 const char *&PrevSpec,
715 Decl *Rep,
bool Owned,
717 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
722 const char *&PrevSpec,
724 Decl *Rep,
bool Owned,
726 assert(isDeclRep(T) &&
"T does not store a decl");
731 DiagID = diag::err_invalid_decl_spec_combination;
737 TSTNameLoc = TagNameLoc;
738 TypeSpecOwned = Owned && Rep !=
nullptr;
743 const char *&PrevSpec,
746 assert(!isDeclRep(T) && !isTypeRep(T) && !isExprRep(T) &&
747 "rep required for these type-spec kinds!");
750 DiagID = diag::err_invalid_decl_spec_combination;
755 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
756 TypeAltiVecBool =
true;
760 TypeSpecOwned =
false;
765 const char *&PrevSpec,
unsigned &DiagID,
769 DiagID = diag::err_invalid_vector_decl_spec_combination;
772 TypeAltiVecVector = isAltiVecVector;
778 const char *&PrevSpec,
unsigned &DiagID,
783 DiagID = diag::err_invalid_decl_spec_combination;
794 const char *&PrevSpec,
unsigned &DiagID,
796 if (!TypeAltiVecVector || TypeAltiVecPixel ||
799 DiagID = diag::err_invalid_pixel_decl_spec_combination;
802 TypeAltiVecPixel = isAltiVecPixel;
809 const char *&PrevSpec,
unsigned &DiagID,
811 if (!TypeAltiVecVector || TypeAltiVecBool ||
814 DiagID = diag::err_invalid_vector_bool_decl_spec;
817 TypeAltiVecBool = isAltiVecBool;
825 TypeSpecOwned =
false;
837 if (TypeQualifiers & T) {
838 bool IsExtension =
true;
841 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
846 case TQ_unspecified:
break;
847 case TQ_const: TQ_constLoc = Loc;
return false;
848 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
849 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
850 case TQ_unaligned: TQ_unalignedLoc = Loc;
return false;
851 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
854 llvm_unreachable(
"Unknown type qualifier!");
861 if (FS_inline_specified) {
862 DiagID = diag::warn_duplicate_declspec;
866 FS_inline_specified =
true;
873 if (FS_forceinline_specified) {
874 DiagID = diag::warn_duplicate_declspec;
875 PrevSpec =
"__forceinline";
878 FS_forceinline_specified =
true;
879 FS_forceinlineLoc = Loc;
884 const char *&PrevSpec,
888 if (FS_virtual_specified) {
889 DiagID = diag::warn_duplicate_declspec;
890 PrevSpec =
"virtual";
893 FS_virtual_specified =
true;
899 const char *&PrevSpec,
903 if (FS_explicit_specified) {
904 DiagID = diag::warn_duplicate_declspec;
905 PrevSpec =
"explicit";
908 FS_explicit_specified =
true;
909 FS_explicitLoc = Loc;
914 const char *&PrevSpec,
918 if (FS_noreturn_specified) {
919 DiagID = diag::warn_duplicate_declspec;
920 PrevSpec =
"_Noreturn";
923 FS_noreturn_specified =
true;
924 FS_noreturnLoc = Loc;
930 if (Friend_specified) {
937 DiagID = diag::warn_duplicate_declspec;
941 Friend_specified =
true;
948 if (isModulePrivateSpecified()) {
949 PrevSpec =
"__module_private__";
950 DiagID = diag::ext_duplicate_declspec;
954 ModulePrivateLoc = Loc;
962 if (Constexpr_specified) {
963 DiagID = diag::warn_duplicate_declspec;
964 PrevSpec =
"constexpr";
967 Constexpr_specified =
true;
972 void DeclSpec::SaveWrittenBuiltinSpecs() {
973 writtenBS.Sign = getTypeSpecSign();
974 writtenBS.Width = getTypeSpecWidth();
975 writtenBS.Type = getTypeSpecType();
977 writtenBS.ModeAttr =
false;
980 if (attrs->
getKind() == AttributeList::AT_Mode) {
981 writtenBS.ModeAttr =
true;
994 SaveWrittenBuiltinSpecs();
1001 TypeSpecComplex != TSC_unspecified ||
1003 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1005 const unsigned NumLocs = 9;
1007 TSWRange.getBegin(), TSCLoc, TSSLoc,
1008 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1009 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1012 for (
unsigned I = 0; I != NumLocs; ++I) {
1017 FirstLoc = ExtraLocs[I];
1022 TypeSpecComplex = TSC_unspecified;
1024 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1026 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1027 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1028 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1032 if (TypeAltiVecVector) {
1033 if (TypeAltiVecBool) {
1036 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1037 << getSpecifierName((
TSS)TypeSpecSign);
1042 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1043 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1044 << (TypeAltiVecPixel ?
"__pixel" :
1045 getSpecifierName((
TST)TypeSpecType, Policy));
1051 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
1052 << getSpecifierName((
TSW)TypeSpecWidth);
1059 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1069 S.
Diag(TSWRange.getBegin(),
1070 diag::err_invalid_vector_long_double_decl_spec);
1073 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1079 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1080 }
else if (TypeSpecWidth ==
TSW_long) {
1083 S.
Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
1085 S.
Diag(TSWRange.getBegin(),
1086 diag::warn_vector_long_decl_spec_combination)
1087 << getSpecifierName((
TST)TypeSpecType, Policy);
1090 if (TypeAltiVecPixel) {
1095 TypeSpecOwned =
false;
1105 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1106 << getSpecifierName((
TST)TypeSpecType, Policy);
1113 switch (TypeSpecWidth) {
1119 else if (TypeSpecType !=
TST_int) {
1120 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1121 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1123 TypeSpecOwned =
false;
1130 S.
Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
1131 << (
int)TypeSpecWidth << getSpecifierName((
TST)TypeSpecType, Policy);
1133 TypeSpecOwned =
false;
1140 if (TypeSpecComplex != TSC_unspecified) {
1142 S.
Diag(TSCLoc, diag::ext_plain_complex)
1150 S.
Diag(TSTLoc, diag::ext_integer_complex);
1152 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1153 << getSpecifierName((
TST)TypeSpecType, Policy);
1154 TypeSpecComplex = TSC_unspecified;
1162 switch (StorageClassSpec) {
1163 case SCS_unspecified:
1165 case SCS_private_extern:
1170 getThreadStorageClassSpecLoc(), getStorageClassSpecLoc()))
1171 S.
Diag(getStorageClassSpecLoc(),
1172 diag::err_invalid_decl_spec_combination)
1176 S.
Diag(getThreadStorageClassSpecLoc(),
1177 diag::err_invalid_decl_spec_combination)
1193 StorageClassSpec = SCS_unspecified;
1194 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1200 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1202 StorageClassSpec == SCS_auto)
1203 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1206 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1207 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1208 if (Constexpr_specified)
1209 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1214 if (isFriendSpecified() &&
1215 (getStorageClassSpec() || getThreadStorageClassSpec())) {
1221 SpecName = getSpecifierName(SC);
1222 SCLoc = getStorageClassSpecLoc();
1227 if (!SpecName.empty()) SpecName +=
" ";
1228 SpecName += getSpecifierName(
TSC);
1229 SCLoc = getThreadStorageClassSpecLoc();
1233 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1234 << SpecName << StorageHint << ThreadHint;
1236 ClearStorageClassSpecs();
1246 if (isFriendSpecified() && (isVirtualSpecified() || isExplicitSpecified())) {
1250 if (isVirtualSpecified()) {
1251 Keyword =
"virtual";
1252 SCLoc = getVirtualSpecLoc();
1254 Keyword =
"explicit";
1255 SCLoc = getExplicitSpecLoc();
1259 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1262 FS_virtual_specified = FS_explicit_specified =
false;
1266 assert(!TypeSpecOwned || isDeclRep((
TST) TypeSpecType));
1276 TST tst = getTypeSpecType();
1277 return isDeclRep(tst) && getRepAsDecl() !=
nullptr &&
1288 for (
unsigned I = 0; I != 3; ++I) {
1291 if (SymbolLocations[I].
isValid())
1297 const char *&PrevSpec) {
1298 if (!FirstLocation.isValid())
1299 FirstLocation = Loc;
1303 if (Specifiers & VS) {
1304 PrevSpec = getSpecifierName(VS);
1311 default: llvm_unreachable(
"Unknown specifier!");
1312 case VS_Override: VS_overrideLoc = Loc;
break;
1315 case VS_Final: VS_finalLoc = Loc;
break;
1323 default: llvm_unreachable(
"Unknown specifier");
1324 case VS_Override:
return "override";
1325 case VS_Final:
return "final";
1326 case VS_GNU_Final:
return "__final";
1327 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.
AttributeList * getNext() const
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. ...
NamespaceDecl - 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()
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
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...
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.
enum clang::DeclaratorChunk::@198 Kind
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.
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.
const FunctionProtoType * T
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
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
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)
NamedDecl - This represents a decl with 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...
AttributeList - Represents a syntactic attribute.
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?