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);
52 Range.
setEnd(ColonColonLoc);
55 "NestedNameSpecifierLoc range computation incorrect");
61 Builder.
Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
65 Range.
setEnd(ColonColonLoc);
68 "NestedNameSpecifierLoc range computation incorrect");
74 Builder.
Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
78 Range.
setEnd(ColonColonLoc);
81 "NestedNameSpecifierLoc range computation incorrect");
87 Builder.
Extend(Context, Alias, AliasLoc, ColonColonLoc);
91 Range.
setEnd(ColonColonLoc);
94 "NestedNameSpecifierLoc range computation incorrect");
104 "NestedNameSpecifierLoc range computation incorrect");
110 Builder.
MakeSuper(Context, RD, SuperLoc, ColonColonLoc);
113 Range.
setEnd(ColonColonLoc);
116 "NestedNameSpecifierLoc range computation incorrect");
133 Builder.
Adopt(Other);
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();
292 if (Bindings.size()) {
293 if (!InlineStorageUsed &&
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");
353 #define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:
354 #include "clang/Basic/OpenCLImageTypes.def"
365 return E->getType()->isFunctionType();
375 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
385 llvm_unreachable(
"Invalid TypeSpecType!");
393 getName().OperatorFunctionId.Operator));
404 return cast<TagDecl>(
getRepAsDecl())->isCompleteDefinition();
422 if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified ||
423 FS_noreturn_specified || FS_forceinline_specified)
429 const char *&PrevSpec,
431 bool IsExtension =
true) {
434 DiagID = diag::err_invalid_decl_spec_combination;
436 DiagID = IsExtension ? diag::ext_duplicate_declspec :
437 diag::warn_duplicate_declspec;
452 llvm_unreachable(
"Unknown typespec!");
462 llvm_unreachable(
"Unknown typespec!");
472 llvm_unreachable(
"Unknown typespec!");
481 llvm_unreachable(
"Unknown typespec!");
491 llvm_unreachable(
"Unknown typespec!");
528 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
529 case DeclSpec::TST_##ImgType##_t: \
530 return #ImgType "_t";
531 #include "clang/Basic/OpenCLImageTypes.def"
534 llvm_unreachable(
"Unknown typespec!");
546 llvm_unreachable(
"Unknown typespec!");
550 const char *&PrevSpec,
567 DiagID = diag::err_opencl_unknown_type_specifier;
574 DiagID = diag::err_opencl_unknown_type_specifier;
590 PrevSpec, DiagID, Policy);
591 assert(!isInvalid &&
"auto SCS -> TST recovery failed");
599 !(SCS_extern_in_linkage_spec &&
604 StorageClassSpec = SC;
605 StorageClassSpecLoc = Loc;
606 assert((
unsigned)SC == StorageClassSpec &&
"SCS constants overflow bitfield");
611 const char *&PrevSpec,
616 ThreadStorageClassSpec =
TSC;
617 ThreadStorageClassSpecLoc = Loc;
625 const char *&PrevSpec,
642 const char *&PrevSpec,
652 const char *&PrevSpec,
662 const char *&PrevSpec,
671 const char *&PrevSpec,
675 assert(
isTypeRep(T) &&
"T does not store a type");
676 assert(Rep &&
"no type provided!");
679 DiagID = diag::err_invalid_decl_spec_combination;
685 TSTNameLoc = TagNameLoc;
686 TypeSpecOwned =
false;
691 const char *&PrevSpec,
695 assert(isExprRep(T) &&
"T does not store an expr");
696 assert(Rep &&
"no expression provided!");
699 DiagID = diag::err_invalid_decl_spec_combination;
706 TypeSpecOwned =
false;
711 const char *&PrevSpec,
713 Decl *Rep,
bool Owned,
715 return SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, Rep, Owned, Policy);
720 const char *&PrevSpec,
722 Decl *Rep,
bool Owned,
724 assert(
isDeclRep(T) &&
"T does not store a decl");
729 DiagID = diag::err_invalid_decl_spec_combination;
735 TSTNameLoc = TagNameLoc;
736 TypeSpecOwned = Owned && Rep !=
nullptr;
741 const char *&PrevSpec,
745 "rep required for these type-spec kinds!");
748 DiagID = diag::err_invalid_decl_spec_combination;
753 if (TypeAltiVecVector && (T ==
TST_bool) && !TypeAltiVecBool) {
754 TypeAltiVecBool =
true;
758 TypeSpecOwned =
false;
763 const char *&PrevSpec,
unsigned &DiagID,
767 DiagID = diag::err_invalid_vector_decl_spec_combination;
770 TypeAltiVecVector = isAltiVecVector;
776 const char *&PrevSpec,
unsigned &DiagID,
781 DiagID = diag::err_invalid_decl_spec_combination;
792 const char *&PrevSpec,
unsigned &DiagID,
794 if (!TypeAltiVecVector || TypeAltiVecPixel ||
797 DiagID = diag::err_invalid_pixel_decl_spec_combination;
800 TypeAltiVecPixel = isAltiVecPixel;
807 const char *&PrevSpec,
unsigned &DiagID,
809 if (!TypeAltiVecVector || TypeAltiVecBool ||
812 DiagID = diag::err_invalid_vector_bool_decl_spec;
815 TypeAltiVecBool = isAltiVecBool;
823 TypeSpecOwned =
false;
835 if (TypeQualifiers & T) {
836 bool IsExtension =
true;
839 return BadSpecifier(T, T, PrevSpec, DiagID, IsExtension);
845 case TQ_const: TQ_constLoc = Loc;
return false;
846 case TQ_restrict: TQ_restrictLoc = Loc;
return false;
847 case TQ_volatile: TQ_volatileLoc = Loc;
return false;
849 case TQ_atomic: TQ_atomicLoc = Loc;
return false;
852 llvm_unreachable(
"Unknown type qualifier!");
859 if (FS_inline_specified) {
860 DiagID = diag::warn_duplicate_declspec;
864 FS_inline_specified =
true;
871 if (FS_forceinline_specified) {
872 DiagID = diag::warn_duplicate_declspec;
873 PrevSpec =
"__forceinline";
876 FS_forceinline_specified =
true;
877 FS_forceinlineLoc = Loc;
882 const char *&PrevSpec,
886 if (FS_virtual_specified) {
887 DiagID = diag::warn_duplicate_declspec;
888 PrevSpec =
"virtual";
891 FS_virtual_specified =
true;
897 const char *&PrevSpec,
901 if (FS_explicit_specified) {
902 DiagID = diag::warn_duplicate_declspec;
903 PrevSpec =
"explicit";
906 FS_explicit_specified =
true;
907 FS_explicitLoc = Loc;
912 const char *&PrevSpec,
916 if (FS_noreturn_specified) {
917 DiagID = diag::warn_duplicate_declspec;
918 PrevSpec =
"_Noreturn";
921 FS_noreturn_specified =
true;
922 FS_noreturnLoc = Loc;
928 if (Friend_specified) {
935 DiagID = diag::warn_duplicate_declspec;
939 Friend_specified =
true;
947 PrevSpec =
"__module_private__";
948 DiagID = diag::ext_duplicate_declspec;
952 ModulePrivateLoc = Loc;
960 if (Constexpr_specified) {
961 DiagID = diag::warn_duplicate_declspec;
962 PrevSpec =
"constexpr";
965 Constexpr_specified =
true;
972 if (Concept_specified) {
973 DiagID = diag::ext_duplicate_declspec;
974 PrevSpec =
"concept";
977 Concept_specified =
true;
982 void DeclSpec::SaveWrittenBuiltinSpecs() {
990 if (attrs->
getKind() == AttributeList::AT_Mode) {
1004 SaveWrittenBuiltinSpecs();
1013 TypeAltiVecVector || TypeAltiVecPixel || TypeAltiVecBool ||
1015 const unsigned NumLocs = 9;
1017 TSWRange.
getBegin(), TSCLoc, TSSLoc,
1018 AltiVecLoc, TQ_constLoc, TQ_restrictLoc,
1019 TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc};
1022 for (
unsigned I = 0;
I != NumLocs; ++
I) {
1023 if (ExtraLocs[
I].isValid()) {
1027 FirstLoc = ExtraLocs[I];
1034 TypeAltiVecVector = TypeAltiVecPixel = TypeAltiVecBool =
false;
1036 S.
Diag(TSTLoc, diag::err_decltype_auto_cannot_be_combined)
1037 << Hints[0] << Hints[1] << Hints[2] << Hints[3]
1038 << Hints[4] << Hints[5] << Hints[6] << Hints[7];
1042 if (TypeAltiVecVector) {
1043 if (TypeAltiVecBool) {
1046 S.
Diag(TSSLoc, diag::err_invalid_vector_bool_decl_spec)
1052 (TypeSpecType !=
TST_int)) || TypeAltiVecPixel) {
1053 S.
Diag(TSTLoc, diag::err_invalid_vector_bool_decl_spec)
1054 << (TypeAltiVecPixel ?
"__pixel" :
1061 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_vector_bool_decl_spec)
1069 S.
Diag(TSTLoc, diag::err_invalid_vector_long_long_decl_spec);
1080 diag::err_invalid_vector_long_double_decl_spec);
1083 S.
Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
1089 S.
Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
1090 }
else if (TypeSpecWidth ==
TSW_long) {
1093 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_vector_long_decl_spec);
1096 diag::warn_vector_long_decl_spec_combination)
1100 if (TypeAltiVecPixel) {
1105 TypeSpecOwned =
false;
1115 S.
Diag(TSSLoc, diag::err_invalid_sign_spec)
1123 switch (TypeSpecWidth) {
1129 else if (TypeSpecType !=
TST_int) {
1130 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_width_spec)
1133 TypeSpecOwned =
false;
1140 S.
Diag(TSWRange.
getBegin(), diag::err_invalid_width_spec)
1143 TypeSpecOwned =
false;
1152 S.
Diag(TSCLoc, diag::ext_plain_complex)
1160 S.
Diag(TSTLoc, diag::ext_integer_complex);
1162 S.
Diag(TSCLoc, diag::err_invalid_complex_spec)
1172 switch (StorageClassSpec) {
1182 diag::err_invalid_decl_spec_combination)
1187 diag::err_invalid_decl_spec_combination)
1204 TSTLoc = TSTNameLoc = StorageClassSpecLoc;
1210 S.
Diag(TSTLoc, diag::ext_auto_type_specifier);
1213 S.
Diag(StorageClassSpecLoc, diag::warn_auto_storage_class)
1216 S.
Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
1217 << (TypeSpecType ==
TST_char16 ?
"char16_t" :
"char32_t");
1218 if (Constexpr_specified)
1219 S.
Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
1237 if (!SpecName.empty()) SpecName +=
" ";
1243 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1244 << SpecName << StorageHint << ThreadHint;
1261 Keyword =
"virtual";
1264 Keyword =
"explicit";
1269 S.
Diag(SCLoc, diag::err_friend_decl_spec)
1272 FS_virtual_specified = FS_explicit_specified =
false;
1276 assert(!TypeSpecOwned ||
isDeclRep((
TST) TypeSpecType));
1298 for (
unsigned I = 0;
I != 3; ++
I) {
1307 const char *&PrevSpec) {
1309 FirstLocation = Loc;
1313 if (Specifiers & VS) {
1321 default: llvm_unreachable(
"Unknown specifier!");
1325 case VS_Final: VS_finalLoc = Loc;
break;
1333 default: llvm_unreachable(
"Unknown specifier");
SourceLocation getThreadStorageClassSpecLoc() const
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
IdKind getKind() const
Determine what kind of name we have.
unsigned MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
no exception specification
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.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getExplicitSpecLoc() const
TSW getTypeSpecWidth() const
static const TSS TSS_unsigned
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...
TheContext getContext() const
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
static const TST TST_wchar
Decl * getRepAsDecl() const
const LangOptions & getLangOpts() const
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
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.
SCS getStorageClassSpec() const
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".
static const char * getSpecifierName(Specifier VS)
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
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)
TypeSpecifierType
Specifies the kind of type.
static const TST TST_interface
static const TST TST_char
void setBegin(SourceLocation b)
Describes how types, statements, expressions, and declarations should be printed. ...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
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
AttributeList * getList() const
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.
TSS getTypeSpecSign() const
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
static const TSW TSW_unspecified
void ClearStorageClassSpecs()
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)
SourceLocation getBeginLoc() const
Get the begin source location.
const TargetInfo & getTargetInfo() const
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)
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
detail::InMemoryDirectory::const_iterator I
static const TST TST_float
DecompositionDeclarator::Binding InlineBindings[16]
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
Sema - This implements semantic analysis and AST building for C.
static const TSW TSW_long
TST getTypeSpecType() const
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.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
static bool isDeclRep(TST T)
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.
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function...
SourceLocation getTypeSpecComplexLoc() const
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
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.
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed...
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
SourceLocation Loc
Loc - The place where this type was defined.
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.
SourceLocation getStorageClassSpecLoc() const
static bool BadSpecifier(T TNew, T TPrev, const char *&PrevSpec, unsigned &DiagID, bool IsExtension=true)
static const TSW TSW_short
bool isVirtualSpecified() const
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 ...
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
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.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
bool SetConceptSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Encodes a location in the source.
static const TST TST_auto_type
An overloaded operator name, e.g., operator+.
Expr * getRepAsExpr() const
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
bool isValid() const
Return true if this is a valid SourceLocation object.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder...
static const TST TST_union
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.
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...
ParsedType getRepAsType() const
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
static const TSS TSS_signed
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
SourceLocation getVirtualSpecLoc() const
static const TST TST_typeofType
SourceLocation getBegin() const
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)
A constructor named via a template-id.
static const TST TST_decltype_auto
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool isEnabled(llvm::StringRef Ext) const
static bool isInvalid(LocType Loc, bool *Invalid)
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
TSCS getThreadStorageClassSpec() const
static const TSS TSS_unspecified
static const TST TST_decltype
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static const TST TST_auto
bool isFriendSpecified() const
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.
bool hasTagDefinition() const
unsigned ConstQualifierLoc
The location of the const-qualifier, if any.
detail::InMemoryDirectory::const_iterator E
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
static const TST TST_unspecified
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
static const TST TST_decimal128
SourceManager & getSourceManager() const
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.
A template-id, e.g., f<int>.
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.
bool isExplicitSpecified() const
void setEnd(SourceLocation e)
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
static const TST TST_bool
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
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 TSW TSW_longlong
static Decl::Kind getKind(const Decl *D)
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
static const TST TST_atomic
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...
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...
AttributeList * getNext() const
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.
bool isModulePrivateSpecified() const
Represents a C++ namespace alias.
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
static const TSCS TSCS__Thread_local
bool isNull() const
Return true if this QualType doesn't point to a type yet.
enum clang::UnqualifiedId::IdKind Kind
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedAttributes & getAttributes()
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
AttributeList - Represents a syntactic attribute.
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?