23 #ifndef LLVM_CLANG_SEMA_DECLSPEC_H
24 #define LLVM_CLANG_SEMA_DECLSPEC_H
34 #include "llvm/ADT/SmallVector.h"
35 #include "llvm/Support/Compiler.h"
36 #include "llvm/Support/ErrorHandling.h"
44 class NamespaceAliasDecl;
49 struct TemplateIdAnnotation;
200 assert(R.
isValid() &&
"Must have a valid source range");
303 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
304 static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t;
305 #include "clang/Basic/OpenCLImageTypes.def"
332 unsigned StorageClassSpec : 3;
333 unsigned ThreadStorageClassSpec : 2;
334 unsigned SCS_extern_in_linkage_spec : 1;
337 unsigned TypeSpecWidth : 2;
338 unsigned TypeSpecComplex : 2;
339 unsigned TypeSpecSign : 2;
340 unsigned TypeSpecType : 6;
341 unsigned TypeAltiVecVector : 1;
342 unsigned TypeAltiVecPixel : 1;
343 unsigned TypeAltiVecBool : 1;
344 unsigned TypeSpecOwned : 1;
345 unsigned TypeSpecPipe : 1;
348 unsigned TypeQualifiers : 5;
351 unsigned FS_inline_specified : 1;
352 unsigned FS_forceinline_specified: 1;
353 unsigned FS_virtual_specified : 1;
354 unsigned FS_explicit_specified : 1;
355 unsigned FS_noreturn_specified : 1;
358 unsigned Friend_specified : 1;
361 unsigned Constexpr_specified : 1;
364 unsigned Concept_specified : 1;
391 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
393 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
395 SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc, ConceptLoc;
399 void SaveWrittenBuiltinSpecs();
407 static bool isExprRep(
TST T) {
411 DeclSpec(
const DeclSpec &) =
delete;
412 void operator=(
const DeclSpec &) =
delete;
423 SCS_extern_in_linkage_spec(
false),
428 TypeAltiVecVector(
false),
429 TypeAltiVecPixel(
false),
430 TypeAltiVecBool(
false),
431 TypeSpecOwned(
false),
434 FS_inline_specified(
false),
435 FS_forceinline_specified(
false),
436 FS_virtual_specified(
false),
437 FS_explicit_specified(
false),
438 FS_noreturn_specified(
false),
439 Friend_specified(
false),
440 Constexpr_specified(
false),
441 Concept_specified(
false),
444 ObjCQualifiers(nullptr) {
450 return (
TSCS)ThreadStorageClassSpec;
454 SCS_extern_in_linkage_spec =
Value;
459 return ThreadStorageClassSpecLoc;
465 SCS_extern_in_linkage_spec =
false;
472 TypeSpecOwned =
false;
489 assert(
isTypeRep((
TST) TypeSpecType) &&
"DeclSpec does not store a type");
493 assert(
isDeclRep((
TST) TypeSpecType) &&
"DeclSpec does not store a decl");
497 assert(isExprRep((
TST) TypeSpecType) &&
"DeclSpec does not store an expr");
563 return FS_inline_specified | FS_forceinline_specified;
566 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
579 FS_inline_specified =
false;
581 FS_forceinline_specified =
false;
583 FS_virtual_specified =
false;
585 FS_explicit_specified =
false;
587 FS_noreturn_specified =
false;
623 const char *&PrevSpec,
unsigned &DiagID,
626 const char *&PrevSpec,
unsigned &DiagID);
639 unsigned &DiagID,
Decl *Rep,
bool Owned,
647 unsigned &DiagID,
Decl *Rep,
bool Owned,
651 unsigned &DiagID,
Expr *Rep,
654 const char *&PrevSpec,
unsigned &DiagID,
657 const char *&PrevSpec,
unsigned &DiagID,
660 const char *&PrevSpec,
unsigned &DiagID,
663 const char *&PrevSpec,
unsigned &DiagID,
675 assert(isExprRep((
TST) TypeSpecType));
715 Constexpr_specified =
false;
720 Concept_specified =
false;
820 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
843 "Objective-C declspec doesn't have nullability");
850 "Objective-C declspec doesn't have nullability");
851 return NullabilityLoc;
857 "Set the nullability declspec or property attribute first");
859 NullabilityLoc = loc;
882 unsigned objcDeclQualifier : 7;
885 unsigned PropertyAttributes : 15;
1226 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1350 Params[
I].DefaultArgTokens.reset();
1487 Scope().~CXXScopeSpec();
1566 bool isStatic,
bool isStar,
Expr *NumElts,
1585 ParamInfo *Params,
unsigned NumParams,
1589 bool RefQualifierIsLvalueRef,
1599 unsigned NumExceptions,
1675 unsigned NumBindings : 31;
1676 unsigned DeleteBindings : 1;
1682 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1696 DeleteBindings =
false;
1700 return llvm::makeArrayRef(Bindings, NumBindings);
1781 unsigned InvalidType : 1;
1784 unsigned GroupingParens : 1;
1790 unsigned FunctionDefinition : 2;
1793 unsigned Redeclaration : 1;
1796 unsigned Extension : 1;
1799 unsigned ObjCIvar : 1;
1802 unsigned ObjCWeakProperty : 1;
1805 unsigned InlineStorageUsed : 1;
1841 ObjCWeakProperty(
false), InlineStorageUsed(
false),
1871 return BindingGroup;
1916 BindingGroup.
clear();
1918 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1919 DeclTypeInfo[i].destroy();
1920 DeclTypeInfo.clear();
1923 InlineStorageUsed =
false;
1925 ObjCWeakProperty =
false;
1963 llvm_unreachable(
"unknown context kind!");
1999 llvm_unreachable(
"unknown context kind!");
2039 llvm_unreachable(
"unknown context kind!");
2092 llvm_unreachable(
"unknown context kind!");
2111 return BindingGroup.
isSet();
2116 return Name.Identifier;
2124 Name.setIdentifier(Id, IdLoc);
2138 DeclTypeInfo.push_back(TI);
2139 DeclTypeInfo.back().getAttrListRef() = attrs.
getList();
2148 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2157 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2158 return DeclTypeInfo[i];
2161 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2162 return DeclTypeInfo[i];
2174 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2175 DeclTypeInfo.front().destroy();
2176 DeclTypeInfo.erase(DeclTypeInfo.begin());
2183 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2184 if (!DeclTypeInfo[i].isParen())
2185 return &DeclTypeInfo[i];
2194 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2195 if (!DeclTypeInfo[i-1].isParen())
2196 return &DeclTypeInfo[i-1];
2215 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2216 switch (DeclTypeInfo[i].
Kind) {
2230 llvm_unreachable(
"Invalid type chunk");
2249 return DeclTypeInfo[index].Fun;
2301 llvm_unreachable(
"unknown context kind!");
2322 Chunk.Fun.hasTrailingReturnType())
2363 Ranges.push_back(AttrList->
getRange());
2364 AttrList = AttrList->
getNext();
2397 FunctionDefinition = Val;
2449 const char *&PrevSpec);
2469 unsigned Specifiers;
2499 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2500 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType) {}
2526 #endif // LLVM_CLANG_SEMA_DECLSPEC_H
SourceLocation getLocEnd() const LLVM_READONLY
void ClearFunctionSpecs()
SourceLocation getThreadStorageClassSpecLoc() const
SourceLocation getEnd() const
void setConstructorName(ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a constructor name.
unsigned UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
IdKind getKind() const
Determine what kind of name we have.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
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
SourceLocation getRestrictSpecLoc() const
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool hasAttributes() const
hasAttributes - do we contain any attributes?
void clear()
Reset the contents of this Declarator.
const AttributeList * getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
SourceLocation getConstSpecLoc() const
SourceLocation getExplicitSpecLoc() const
TSW getTypeSpecWidth() const
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
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...
const DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo() const
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
TheContext getContext() const
static const TST TST_wchar
Decl * getRepAsDecl() const
ThreadStorageClassSpecifier TSCS
bool isArrayOfUnknownBound() const
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of un...
const ParsedAttributes & getAttributes() const
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
NullabilityKind
Describes the nullability of a particular type.
A conversion function name, e.g., operator int.
void setEndLoc(SourceLocation Loc)
static const TST TST_typeofExpr
static const TST TST_char16
void setPropertyAttributes(ObjCPropertyAttributeKind PRVal)
Decl - This represents one declaration (or definition), e.g.
SourceRange getRange() const
unsigned ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
bool isTypeAltiVecBool() const
bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
Captures information about "declaration specifiers" specific to Objective-C.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
AttributePool & getAttributePool() const
unsigned EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
SourceRange getSourceRange() const
bool hasAutoTypeSpec() const
SCS getStorageClassSpec() const
FunctionDefinitionKind getFunctionDefinitionKind() const
const DecompositionDeclarator & getDecompositionDeclarator() 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.
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".
LambdaCaptureInitKind InitKind
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
SourceLocation getInlineSpecLoc() const
static const char * getSpecifierName(Specifier VS)
SourceLocation getSetterNameLoc() const
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
AttributeList *& getAttrListRef()
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...
bool isConceptSpecified() const
unsigned RefQualifierLoc
The location of the ref-qualifier, if any.
unsigned RestrictQualLoc
The location of the restrict-qualifier, if any.
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
static const TSCS TSCS_unspecified
SourceLocation getCommaLoc() const
void setObjCQualifiers(ObjCDeclSpec *quals)
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
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)
SourceLocation getLSquareLoc() const
void setTypeofParensRange(SourceRange range)
SourceLocation getEllipsisLoc() const
bool isObjCWeakProperty() const
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. ...
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
const DeclaratorChunk * getOutermostNonParenChunk() const
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chu...
void addAll(AttributeList *newList)
bool isEmpty() const
No scope specifier.
Information about a template-id annotation token.
IdentifierInfo * getGetterName()
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.
SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
bool getExtension() const
static const TST TST_decimal32
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
AttributeList * getList() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void DropFirstTypeObject()
A C++ nested-name-specifier augmented with source location information.
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier, if any.
bool isTypeSpecPipe() const
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
SourceLocation getTypeSpecSignLoc() const
unsigned VolatileQualifierLoc
The location of the volatile-qualifier, if any.
TSS getTypeSpecSign() const
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
DeclSpec(AttributeFactory &attrFactory)
static const TST TST_class
LambdaCaptureKind
The different capture forms in a lambda introducer.
UnionParsedTemplateTy TemplateName
When Kind == IK_DeductionGuideName, the parsed template-name.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
OverloadedOperatorKind Operator
The kind of overloaded operator.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned The qualifier bitmask values are the same as...
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
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)
bool isNoreturnSpecified() const
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
static const TST TST_error
static const TST TST_enum
SourceLocation getFirstLocation() const
SourceLocation getTypeSpecTypeLoc() const
SourceLocation getLocStart() const LLVM_READONLY
static const TSW TSW_unspecified
void ClearStorageClassSpecs()
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
Return a DeclaratorChunk for a pointer.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool mayBeFollowedByCXXDirectInit() const
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initiali...
void SetSourceRange(SourceRange R)
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
UnionParsedType DestructorName
When Kind == IK_DestructorName, the type referred to by the class-name.
void setExternInLinkageSpec(bool Value)
Represents a C++ unqualified-id that has been parsed.
void setObjCWeakProperty(bool Val=true)
ObjCPropertyAttributeKind
PropertyAttributeKind - list of property attributes.
void addAttributes(AttributeList *AL)
Concatenates two attribute lists.
bool hasGroupingParens() const
unsigned ConstQualLoc
The location of the const-qualifier, if any.
void setExtension(bool Val=true)
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
ParamInfo(IdentifierInfo *ident, SourceLocation iloc, Decl *param, std::unique_ptr< CachedTokens > DefArgTokens=nullptr)
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void SetRangeBegin(SourceLocation Loc)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SCS
storage-class-specifier
char * location_data() const
Retrieve the data associated with the source-location information.
SourceLocation getLocStart() const LLVM_READONLY
void setRedeclaration(bool Val)
An implicit 'self' parameter.
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
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.
SourceLocation getEndLoc() const
const IdentifierInfo * getSetterName() const
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
Represents a C++ nested-name-specifier or a global scope specifier.
enum clang::DeclaratorChunk::@196 Kind
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
SourceLocation getConceptSpecLoc() const
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void UpdateExprRep(Expr *Rep)
bool isExternInLinkageSpec() const
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
bool isFunctionDeclaratorAFunctionDeclaration() const
Return true if a function declarator at this position would be a function declaration.
SourceLocation getAltiVecLoc() const
SourceRange getTypeSpecWidthRange() const
SourceLocation getLocStart() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
detail::InMemoryDirectory::const_iterator I
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced...
SourceRange getRange() const
static const TST TST_float
DecompositionDeclarator::Binding InlineBindings[16]
Class that aids in the construction of nested-name-specifiers along with source-location information ...
Declarator(const DeclSpec &ds, TheContext C)
unsigned AccessWrites
The access writes.
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
SourceRange getTypeofParensRange() const
Sema - This implements semantic analysis and AST building for C.
static const TSW TSW_long
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType)
TST getTypeSpecType() const
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
void setSetterName(IdentifierInfo *name, SourceLocation loc)
void ClearConstexprSpec()
SourceLocation getModulePrivateSpecLoc() const
ObjCPropertyAttributeKind getPropertyAttributes() const
IdentifierInfo * getSetterName()
void SetRangeStart(SourceLocation Loc)
SourceLocation getFriendSpecLoc() const
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
SmallVector< LambdaCapture, 4 > Captures
bool mayOmitIdentifier() const
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
AttributeList * getAttributes()
static bool isDeclRep(TST T)
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
SourceLocation getLParenLoc() const
llvm::iterator_range< type_object_iterator > type_object_range
unsigned hasStatic
True if this dimension included the 'static' keyword.
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier, if any.
Expr - This represents one expression.
void setDecompositionBindings(SourceLocation LSquareLoc, ArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
void setDeductionGuideName(ParsedTemplateTy Template, SourceLocation TemplateLoc)
Specify that this unqualified-id was parsed as a template-name for a deduction-guide.
SourceLocation getAtomicSpecLoc() const
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function...
SourceLocation getTypeSpecComplexLoc() const
An individual capture in a lambda introducer.
bool isFunctionDefinition() const
DeclaratorChunk & getTypeObject(unsigned i)
unsigned VolatileQualLoc
The location of the volatile-qualifier, if any.
unsigned SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new", "[", and "]" tokens in operator new [].
static DeclaratorChunk getPipe(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
void freeParams()
Reset the parameter list to having zero parameters.
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
void clear()
Clear out this unqualified-id, setting it to default (invalid) state.
Defines an enumeration for C++ overloaded operators.
void setAsmLabel(Expr *E)
void setRange(SourceRange R)
SourceLocation getVolatileSpecLoc() const
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
A parsed C++17 decomposition declarator of the form '[' identifier-list ']'.
SourceLocation EllipsisLoc
Represents a C++ template name within the type system.
static const TST TST_decimal64
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear...
SourceLocation getLastLocation() const
void UpdateTypeRep(ParsedType Rep)
bool isConstexprSpecified() const
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed...
Expr * getAsmLabel() const
bool isDecompositionDeclarator() const
Return whether this declarator is a decomposition declarator.
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
SourceLocation Loc
Loc - The place where this type was defined.
void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
Specific that this unqualified-id was parsed as a literal-operator-id.
SourceLocation getGetterNameLoc() const
bool mayHaveDecompositionDeclarator() const
Return true if the context permits a C++17 decomposition declarator.
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier, if any.
void setEllipsisLoc(SourceLocation EL)
bool SetTypeSpecSign(TSS S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
ParsedType InitCaptureType
static const TST TST_half
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
ObjCDeclSpec * getObjCQualifiers() const
Wraps an identifier and optional source location for the identifier.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
SourceLocation getStorageClassSpecLoc() const
static const TSW TSW_short
bool isVirtualSpecified() const
SourceLocation getNullabilityLoc() const
IdKind
Describes the kind of unqualified-id parsed.
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...
AttributePool & getAttributePool() const
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
static const TST TST_char32
static DeclaratorChunk getParen(SourceLocation LParenLoc, SourceLocation RParenLoc)
Return a DeclaratorChunk for a paren.
bool isPrototypeContext() const
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
bool isKNRPrototype() const
isKNRPrototype - Return true if this is a K&R style identifier list, like "void foo(a,b,c)".
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
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)
SourceLocation DefaultLoc
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc, bool lvalue)
Return a DeclaratorChunk for a reference.
Encodes a location in the source.
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType)
Append a capture in a lambda introducer.
static const TST TST_auto_type
ParsedSpecifiers
ParsedSpecifiers - Flags to query which specifiers were applied.
Specifier getLastSpecifier() const
An overloaded operator name, e.g., operator+.
Expr * getRepAsExpr() const
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
A deduction-guide name (a template-name)
bool isValid() const
Return true if this is a valid SourceLocation object.
std::pair< char *, unsigned > getBuffer() const
Retrieve the underlying buffer.
SourceLocation getPipeLoc() const
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
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.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
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...
SourceLocation getExceptionSpecLocEnd() const
ParsedType getRepAsType() const
char ScopeMem[sizeof(CXXScopeSpec)]
TSC getTypeSpecComplex() const
static const TSS TSS_signed
void setGroupingParens(bool flag)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SourceRange getExceptionSpecRange() const
bool isInvalid() const
An error occurred during parsing of the scope specifier.
MemberPointerTypeInfo Mem
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
SourceLocation getConstexprSpecLoc() const
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk...
Represents a C++11 virt-specifier-seq.
SourceLocation getVirtualSpecLoc() const
bool isFinalSpelledSealed() const
SourceLocation getUnalignedSpecLoc() const
static const TST TST_typeofType
SourceLocation getBegin() const
SourceLocation getBeginLoc() const
void setKind(IdKind kind)
AttributeList *& getAttrListRef()
bool hasAttributes() const
FunctionDefinitionKind
Described the kind of function definition (if any) provided for a function.
bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const LangOptions &Lang)
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
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 DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
SourceLocation getExceptionSpecLocBeg() const
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
DecompositionDeclarator & operator=(const DecompositionDeclarator &G)=delete
A constructor named via a template-id.
ArrayRef< NamedDecl * > getDeclsInPrototype() const
Get the non-parameter decls defined within this function prototype.
Defines various enumerations that describe declaration and type specifiers.
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
void takeAttributes(ParsedAttributes &attrs, SourceLocation lastLoc)
takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarato...
ObjCDeclQualifier getObjCDeclQualifier() const
static const TST TST_decltype_auto
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
TSCS getThreadStorageClassSpec() const
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
FieldDeclarator(const DeclSpec &DS)
static const TSS TSS_unspecified
LambdaCaptureDefault Default
DecompositionDeclarator()
void setObjCIvar(bool Val=true)
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 getTypeSpecTypeNameLoc() const
static const TST TST_int128
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
SourceLocation getFinalLoc() const
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
bool isFinalSpecified() const
bool hasTagDefinition() const
unsigned ConstQualifierLoc
The location of the const-qualifier, if any.
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
SourceLocation getLocEnd() const LLVM_READONLY
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
detail::InMemoryDirectory::const_iterator E
SourceLocation getNoreturnSpecLoc() const
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
ArrayRef< Binding > bindings() const
static const TST TST_unspecified
bool isFirstDeclarator() const
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
static const TST TST_decimal128
void takeAttributesFrom(ParsedAttributes &attrs)
static const TSCS TSCS___thread
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
bool isRedeclaration() const
bool mayHaveIdentifier() const
mayHaveIdentifier - Return true if the identifier is either optional or required. ...
unsigned LParenLoc
The location of the left parenthesis in the source.
void setNullability(SourceLocation loc, NullabilityKind kind)
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
CXXScopeSpec & getCXXScopeSpec()
void SetRangeEnd(SourceLocation Loc)
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
ActionResult< ParsedType > TypeResult
unsigned AtomicQualLoc
The location of the _Atomic-qualifier, if any.
bool isInlineSpecified() const
A template-id, e.g., f<int>.
CXXScopeSpec & getTypeSpecScope()
IdentifierInfo * getIdentifier() const
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
Structure that packs information about the type specifiers that were written in a particular type spe...
void getCXX11AttributeRanges(SmallVectorImpl< SourceRange > &Ranges)
Return a source range list of C++11 attributes associated with the declarator.
bool isCXX11Attribute() const
SourceLocation getRSquareLoc() const
void setInvalidType(bool Val=true)
unsigned TypeQuals
For now, sema will catch these as invalid.
static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
AttributePool & getPool() const
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".
bool isExplicitSpecified() const
SourceLocation getIdentifierLoc() const
void setEnd(SourceLocation e)
void UpdateDeclRep(Decl *Rep)
Represents a C++ struct/union/class.
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
static const TSCS TSCS_thread_local
A user-defined literal name, e.g., operator "" _i.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
static const TST TST_float128
static const TST TST_bool
SourceLocation getOverrideLoc() const
unsigned kind
All of the diagnostics that can be emitted by the frontend.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
bool isOverrideSpecified() const
SourceLocation getRParenLoc() const
bool isTypeSpecOwned() const
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
SourceLocation getTypeSpecWidthLoc() const
Represents a complete lambda introducer.
void ExtendWithDeclSpec(const DeclSpec &DS)
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec, unless its location is invalid.
static const TSW TSW_longlong
void setBeginLoc(SourceLocation Loc)
SourceLocation getMutableLoc() const
Retrieve the location of the 'mutable' qualifier, if any.
bool isTypeAltiVecVector() const
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
bool isSet() const
Deprecated.
static const TST TST_atomic
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
static const TST TST_struct
const CXXScopeSpec & getTypeSpecScope() const
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
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.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
bool isInvalidType() const
unsigned ExceptionSpecLocEnd
The end location of the exception specification, if any.
bool isModulePrivateSpecified() const
NullabilityKind getNullability() const
Represents a C++ namespace alias.
void setGetterName(IdentifierInfo *name, SourceLocation loc)
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
static const TSCS TSCS__Thread_local
void setDestructorName(SourceLocation TildeLoc, ParsedType ClassType, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a destructor name.
bool isFirstDeclarationOfMember()
Returns true if this declares a real member and not a friend.
SourceLocation getLocEnd() const LLVM_READONLY
void SetRangeEnd(SourceLocation Loc)
const IdentifierInfo * getGetterName() const
ParsedAttributes - A collection of parsed attributes.
void setCommaLoc(SourceLocation CL)
~DecompositionDeclarator()
bool isTypeAltiVecPixel() const
const CXXScopeSpec & Scope() const
enum clang::UnqualifiedId::IdKind Kind
SourceRange getSourceRange() const
AttributeList *& getListRef()
Returns a reference to the attribute list.
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...
static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation Loc)
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceLocation getEllipsisLoc() const
const AttributeList * getAttributes() const
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?