23 #ifndef LLVM_CLANG_SEMA_DECLSPEC_H
24 #define LLVM_CLANG_SEMA_DECLSPEC_H
34 #include "llvm/ADT/Optional.h"
35 #include "llvm/ADT/SmallVector.h"
36 #include "llvm/Support/Compiler.h"
37 #include "llvm/Support/ErrorHandling.h"
44 class DiagnosticsEngine;
46 class NamespaceAliasDecl;
48 class NestedNameSpecifier;
49 class NestedNameSpecifierLoc;
54 struct TemplateIdAnnotation;
205 assert(R.
isValid() &&
"Must have a valid source range");
331 unsigned StorageClassSpec : 3;
332 unsigned ThreadStorageClassSpec : 2;
333 unsigned SCS_extern_in_linkage_spec : 1;
336 unsigned TypeSpecWidth : 2;
337 unsigned TypeSpecComplex : 2;
338 unsigned TypeSpecSign : 2;
339 unsigned TypeSpecType : 6;
340 unsigned TypeAltiVecVector : 1;
341 unsigned TypeAltiVecPixel : 1;
342 unsigned TypeAltiVecBool : 1;
343 unsigned TypeSpecOwned : 1;
346 unsigned TypeQualifiers : 4;
349 unsigned FS_inline_specified : 1;
350 unsigned FS_forceinline_specified: 1;
351 unsigned FS_virtual_specified : 1;
352 unsigned FS_explicit_specified : 1;
353 unsigned FS_noreturn_specified : 1;
356 unsigned Friend_specified : 1;
359 unsigned Constexpr_specified : 1;
362 unsigned Concept_specified : 1;
388 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc;
389 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
391 SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc, ConceptLoc;
394 void SaveWrittenBuiltinSpecs();
402 static bool isExprRep(
TST T) {
406 DeclSpec(
const DeclSpec &) =
delete;
407 void operator=(
const DeclSpec &) =
delete;
418 SCS_extern_in_linkage_spec(
false),
423 TypeAltiVecVector(
false),
424 TypeAltiVecPixel(
false),
425 TypeAltiVecBool(
false),
426 TypeSpecOwned(
false),
428 FS_inline_specified(
false),
429 FS_forceinline_specified(
false),
430 FS_virtual_specified(
false),
431 FS_explicit_specified(
false),
432 FS_noreturn_specified(
false),
433 Friend_specified(
false),
434 Constexpr_specified(
false),
435 Concept_specified(
false),
438 ObjCQualifiers(nullptr) {
444 return (
TSCS)ThreadStorageClassSpec;
448 SCS_extern_in_linkage_spec =
Value;
453 return ThreadStorageClassSpecLoc;
459 SCS_extern_in_linkage_spec =
false;
466 TypeSpecOwned =
false;
482 assert(
isTypeRep((
TST) TypeSpecType) &&
"DeclSpec does not store a type");
486 assert(
isDeclRep((
TST) TypeSpecType) &&
"DeclSpec does not store a decl");
490 assert(isExprRep((
TST) TypeSpecType) &&
"DeclSpec does not store an expr");
550 return FS_inline_specified | FS_forceinline_specified;
553 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
566 FS_inline_specified =
false;
568 FS_forceinline_specified =
false;
570 FS_virtual_specified =
false;
572 FS_explicit_specified =
false;
574 FS_noreturn_specified =
false;
610 const char *&PrevSpec,
unsigned &DiagID,
613 const char *&PrevSpec,
unsigned &DiagID);
626 unsigned &DiagID,
Decl *Rep,
bool Owned,
634 unsigned &DiagID,
Decl *Rep,
bool Owned,
638 unsigned &DiagID,
Expr *Rep,
641 const char *&PrevSpec,
unsigned &DiagID,
644 const char *&PrevSpec,
unsigned &DiagID,
647 const char *&PrevSpec,
unsigned &DiagID,
659 assert(isExprRep((
TST) TypeSpecType));
699 Constexpr_specified =
false;
704 Concept_specified =
false;
803 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
824 "Objective-C declspec doesn't have nullability");
831 "Objective-C declspec doesn't have nullability");
832 return NullabilityLoc;
838 "Set the nullability declspec or property attribute first");
839 Nullability =
static_cast<unsigned>(
kind);
840 NullabilityLoc = loc;
858 unsigned PropertyAttributes : 14;
860 unsigned Nullability : 2;
1289 for (
unsigned I = 0; I <
NumParams; ++I) {
1401 Scope().~CXXScopeSpec();
1469 bool isStatic,
bool isStar,
Expr *NumElts,
1488 ParamInfo *Params,
unsigned NumParams,
1492 bool RefQualifierIsLvalueRef,
1502 unsigned NumExceptions,
1615 bool InvalidType : 1;
1618 bool GroupingParens : 1;
1624 unsigned FunctionDefinition : 2;
1627 bool Redeclaration : 1;
1639 bool InlineParamsUsed;
1642 unsigned Extension : 1;
1645 unsigned ObjCIvar : 1;
1648 unsigned ObjCWeakProperty : 1;
1665 Redeclaration(
false),
1668 ObjCWeakProperty(
false) {
1740 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1741 DeclTypeInfo[i].destroy();
1742 DeclTypeInfo.clear();
1745 InlineParamsUsed =
false;
1747 ObjCWeakProperty =
false;
1783 llvm_unreachable(
"unknown context kind!");
1817 llvm_unreachable(
"unknown context kind!");
1850 llvm_unreachable(
"unknown context kind!");
1901 llvm_unreachable(
"unknown context kind!");
1933 DeclTypeInfo.push_back(TI);
1934 DeclTypeInfo.back().getAttrListRef() = attrs.
getList();
1943 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
1952 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
1953 return DeclTypeInfo[i];
1956 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
1957 return DeclTypeInfo[i];
1969 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
1970 DeclTypeInfo.front().destroy();
1971 DeclTypeInfo.erase(DeclTypeInfo.begin());
1978 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
1979 if (!DeclTypeInfo[i].isParen())
1980 return &DeclTypeInfo[i];
1989 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
1990 if (!DeclTypeInfo[i-1].isParen())
1991 return &DeclTypeInfo[i-1];
2010 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2011 switch (DeclTypeInfo[i].
Kind) {
2024 llvm_unreachable(
"Invalid type chunk");
2043 return DeclTypeInfo[index].Fun;
2093 llvm_unreachable(
"unknown context kind!");
2145 Ranges.push_back(AttrList->
getRange());
2146 AttrList = AttrList->
getNext();
2179 FunctionDefinition = Val;
2226 const char *&PrevSpec);
2246 unsigned Specifiers;
2267 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc), Init(Init),
2268 InitCaptureType(InitCaptureType) {}
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.
IdKind getKind() const
Determine what kind of name we have.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
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. Otherwise, it's an rvalue reference...
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
TheContext getContext() const
static const TST TST_wchar
Decl * getRepAsDecl() const
ThreadStorageClassSpecifier TSCS
bool isArrayOfUnknownBound() const
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.
CachedTokens * DefaultArgTokens
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)
SourceRange getRange() const
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.
SCS getStorageClassSpec() const
FunctionDefinitionKind getFunctionDefinitionKind() 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.
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
SourceLocation getInlineSpecLoc() const
static const char * getSpecifierName(Specifier VS)
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)
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)
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. ...
void Finish(DiagnosticsEngine &D, Preprocessor &PP, const PrintingPolicy &Policy)
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
const DeclaratorChunk * getOutermostNonParenChunk() const
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.
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
unsigned ExceptionSpecLoc
The location of the keyword introducing the spec, if any.
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.
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &attrs, SourceLocation EndLoc)
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
const CXXScopeSpec & getCXXScopeSpec() const
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.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
OverloadedOperatorKind Operator
The kind of overloaded operator.
static const TST TST_double
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
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()
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool mayBeFollowedByCXXDirectInit() const
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)
bool hasStatic
True if this dimension included the 'static' keyword.
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.
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)
void setRange(const SourceRange &R)
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SCS
storage-class-specifier
Concrete class used by the front-end to report problems and issues.
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
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.
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
const SourceRange & getSourceRange() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced...
static const TST TST_float
Class that aids in the construction of nested-name-specifiers along with source-location information ...
Declarator(const DeclSpec &ds, TheContext C)
DeclSpec & getMutableDeclSpec()
SourceRange getTypeofParensRange() const
Sema - This implements semantic analysis and AST building for C.
static const TSW TSW_long
bool isFunctionDeclarator(unsigned &idx) const
TST getTypeSpecType() const
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
void ClearConstexprSpec()
SourceLocation getModulePrivateSpecLoc() const
ObjCPropertyAttributeKind getPropertyAttributes() const
IdentifierInfo * getSetterName()
void SetRangeStart(SourceLocation Loc)
SourceLocation getFriendSpecLoc() const
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/atomic.
SmallVector< LambdaCapture, 4 > Captures
bool mayOmitIdentifier() const
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
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier, if any.
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 [].
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)
SourceLocation getVolatileSpecLoc() const
SourceLocation EllipsisLoc
static const TST TST_decimal64
bool isPastIdentifier() const
ParamInfo(IdentifierInfo *ident, SourceLocation iloc, Decl *param, CachedTokens *DefArgTokens=nullptr)
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 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.
const SourceRange & getRange() const
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 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)
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 isKNRPrototype() const
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
char Mem[sizeof(CXXScopeSpec)]
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
static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc, bool lvalue)
Return a DeclaratorChunk for a reference.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, ExprResult Init, ParsedType InitCaptureType)
Append a capture in a lambda introducer.
Specifier getLastSpecifier() const
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.
std::pair< char *, unsigned > getBuffer() const
Retrieve the underlying buffer.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
static const TST TST_union
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)
ParsedType getRepAsType() const
TSC getTypeSpecComplex() const
static const TSS TSS_signed
void setGroupingParens(bool flag)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isInvalid() const
An error occurred during parsing of the scope specifier.
MemberPointerTypeInfo Mem
bool isFunctionDeclarator() const
SourceLocation getConstexprSpecLoc() const
const DeclaratorChunk * getInnermostNonParenChunk() const
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, SourceLocation ESpecLoc, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult())
Represents a C++11 virt-specifier-seq.
SourceLocation getVirtualSpecLoc() const
bool isFinalSpelledSealed() const
static const TST TST_typeofType
SourceLocation getBegin() const
SourceLocation getBeginLoc() const
const SourceRange & getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
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/_Atomic.
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.
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
A constructor named via a template-id.
bool containsPlaceholderType() const
Defines various enumerations that describe declaration and type specifiers.
void takeAttributes(ParsedAttributes &attrs, SourceLocation lastLoc)
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/_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
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
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)
SourceLocation getNoreturnSpecLoc() const
static const TST TST_unspecified
enum clang::DeclaratorChunk::@184 Kind
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)
static const TST TST_decimal128
void takeAttributesFrom(ParsedAttributes &attrs)
static const TSCS TSCS___thread
bool isRedeclaration() const
bool mayHaveIdentifier() const
unsigned LParenLoc
The location of the left parenthesis in the source.
void setNullability(SourceLocation loc, NullabilityKind kind)
void setSetterName(IdentifierInfo *name)
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
void setInvalidType(bool Val=true)
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.
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, ExprResult Init, ParsedType InitCaptureType)
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.
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.
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 diagnoseIdentifier() const
bool isOverrideSpecified() const
SourceLocation getRParenLoc() const
bool isTypeSpecOwned() const
SourceLocation getExceptionSpecLoc() const
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc)
Return a DeclaratorChunk for a pointer.
SourceLocation getTypeSpecWidthLoc() const
bool isStar
True if this dimension was [*]. In this case, NumElts is null.
Represents a complete lambda introducer.
void ExtendWithDeclSpec(const DeclSpec &DS)
void setGetterName(IdentifierInfo *name)
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.
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
const DeclaratorChunk & getTypeObject(unsigned i) const
AttributeList * getNext() const
union clang::DeclaratorChunk::MemberPointerTypeInfo::@189 ScopeMem
A trivial tuple used to represent a source range.
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
bool isInvalidType() const
bool isModulePrivateSpecified() const
NullabilityKind getNullability() 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
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
void setCommaLoc(SourceLocation CL)
bool isTypeAltiVecPixel() const
const CXXScopeSpec & Scope() const
enum clang::UnqualifiedId::IdKind Kind
SourceRange getSourceRange() const
AttributeList *& getListRef()
ParsedAttributes & getAttributes()
const DeclSpec & getDeclSpec() const
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
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?