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");
327 unsigned StorageClassSpec : 3;
328 unsigned ThreadStorageClassSpec : 2;
329 unsigned SCS_extern_in_linkage_spec : 1;
332 unsigned TypeSpecWidth : 2;
333 unsigned TypeSpecComplex : 2;
334 unsigned TypeSpecSign : 2;
335 unsigned TypeSpecType : 6;
336 unsigned TypeAltiVecVector : 1;
337 unsigned TypeAltiVecPixel : 1;
338 unsigned TypeAltiVecBool : 1;
339 unsigned TypeSpecOwned : 1;
340 unsigned TypeSpecPipe : 1;
343 unsigned TypeQualifiers : 4;
346 unsigned FS_inline_specified : 1;
347 unsigned FS_forceinline_specified: 1;
348 unsigned FS_virtual_specified : 1;
349 unsigned FS_explicit_specified : 1;
350 unsigned FS_noreturn_specified : 1;
353 unsigned Friend_specified : 1;
356 unsigned Constexpr_specified : 1;
359 unsigned Concept_specified : 1;
385 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc;
386 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
388 SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc, ConceptLoc;
392 void SaveWrittenBuiltinSpecs();
400 static bool isExprRep(
TST T) {
404 DeclSpec(
const DeclSpec &) =
delete;
405 void operator=(
const DeclSpec &) =
delete;
416 SCS_extern_in_linkage_spec(
false),
421 TypeAltiVecVector(
false),
422 TypeAltiVecPixel(
false),
423 TypeAltiVecBool(
false),
424 TypeSpecOwned(
false),
427 FS_inline_specified(
false),
428 FS_forceinline_specified(
false),
429 FS_virtual_specified(
false),
430 FS_explicit_specified(
false),
431 FS_noreturn_specified(
false),
432 Friend_specified(
false),
433 Constexpr_specified(
false),
434 Concept_specified(
false),
437 ObjCQualifiers(nullptr) {
443 return (
TSCS)ThreadStorageClassSpec;
447 SCS_extern_in_linkage_spec =
Value;
452 return ThreadStorageClassSpecLoc;
458 SCS_extern_in_linkage_spec =
false;
465 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");
553 return FS_inline_specified | FS_forceinline_specified;
556 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
569 FS_inline_specified =
false;
571 FS_forceinline_specified =
false;
573 FS_virtual_specified =
false;
575 FS_explicit_specified =
false;
577 FS_noreturn_specified =
false;
613 const char *&PrevSpec,
unsigned &DiagID,
616 const char *&PrevSpec,
unsigned &DiagID);
629 unsigned &DiagID,
Decl *Rep,
bool Owned,
637 unsigned &DiagID,
Decl *Rep,
bool Owned,
641 unsigned &DiagID,
Expr *Rep,
644 const char *&PrevSpec,
unsigned &DiagID,
647 const char *&PrevSpec,
unsigned &DiagID,
650 const char *&PrevSpec,
unsigned &DiagID,
653 const char *&PrevSpec,
unsigned &DiagID,
665 assert(isExprRep((
TST) TypeSpecType));
705 Constexpr_specified =
false;
710 Concept_specified =
false;
808 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
829 "Objective-C declspec doesn't have nullability");
836 "Objective-C declspec doesn't have nullability");
837 return NullabilityLoc;
843 "Set the nullability declspec or property attribute first");
845 NullabilityLoc = loc;
863 unsigned PropertyAttributes : 14;
1417 Scope().~CXXScopeSpec();
1494 bool isStatic,
bool isStar,
Expr *NumElts,
1513 ParamInfo *Params,
unsigned NumParams,
1517 bool RefQualifierIsLvalueRef,
1527 unsigned NumExceptions,
1651 bool InvalidType : 1;
1654 bool GroupingParens : 1;
1660 unsigned FunctionDefinition : 2;
1663 bool Redeclaration : 1;
1675 bool InlineParamsUsed;
1678 unsigned Extension : 1;
1681 unsigned ObjCIvar : 1;
1684 unsigned ObjCWeakProperty : 1;
1701 Redeclaration(
false),
1704 ObjCWeakProperty(
false) {
1776 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1777 DeclTypeInfo[i].destroy();
1778 DeclTypeInfo.clear();
1781 InlineParamsUsed =
false;
1783 ObjCWeakProperty =
false;
1819 llvm_unreachable(
"unknown context kind!");
1853 llvm_unreachable(
"unknown context kind!");
1886 llvm_unreachable(
"unknown context kind!");
1937 llvm_unreachable(
"unknown context kind!");
1953 return Name.Identifier;
1961 Name.setIdentifier(Id, IdLoc);
1969 DeclTypeInfo.push_back(TI);
1970 DeclTypeInfo.back().getAttrListRef() = attrs.
getList();
1979 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
1988 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
1989 return DeclTypeInfo[i];
1992 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
1993 return DeclTypeInfo[i];
2005 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2006 DeclTypeInfo.front().destroy();
2007 DeclTypeInfo.erase(DeclTypeInfo.begin());
2014 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2015 if (!DeclTypeInfo[i].isParen())
2016 return &DeclTypeInfo[i];
2025 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2026 if (!DeclTypeInfo[i-1].isParen())
2027 return &DeclTypeInfo[i-1];
2046 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2047 switch (DeclTypeInfo[i].
Kind) {
2061 llvm_unreachable(
"Invalid type chunk");
2080 return DeclTypeInfo[index].Fun;
2130 llvm_unreachable(
"unknown context kind!");
2182 Ranges.push_back(AttrList->
getRange());
2183 AttrList = AttrList->
getNext();
2216 FunctionDefinition = Val;
2266 const char *&PrevSpec);
2286 unsigned Specifiers;
2316 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2317 InitKind(InitKind), Init(Init), 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()
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.
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.
CachedTokens * DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
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.
SCS getStorageClassSpec() const
FunctionDefinitionKind getFunctionDefinitionKind() 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, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult())
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
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".
LambdaCaptureInitKind InitKind
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. ...
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
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
OverloadedOperatorKind Operator
The kind of overloaded operator.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict.
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)
union clang::DeclaratorChunk::MemberPointerTypeInfo::@188 ScopeMem
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
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)
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)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
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.
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
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
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 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/atomic.
SmallVector< LambdaCapture, 4 > Captures
unsigned NumExceptions
NumExceptions - This is the number of types in the dynamic-exception- decl, if the function has one...
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
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier, if any.
Expr - This represents one expression.
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
SourceLocation EllipsisLoc
static const TST TST_decimal64
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the
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.
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)
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.
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
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.
enum clang::DeclaratorChunk::@183 Kind
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.
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
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
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
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/_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)
A constructor named via a template-id.
bool containsPlaceholderType() const
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/_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
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...
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)
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)
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)
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_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
diagnoseIdentifier - Return true if the identifier is prohibited and should be diagnosed (because it ...
bool isOverrideSpecified() const
SourceLocation getRParenLoc() const
bool isTypeSpecOwned() const
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc)
Return a DeclaratorChunk for a pointer.
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (...
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)
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec, unless its location is invalid.
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.
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)
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.
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)
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?