22 #ifndef LLVM_CLANG_SEMA_DECLSPEC_H 23 #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");
307 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 308 static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t; 309 #include "clang/Basic/OpenCLImageTypes.def" 328 PQ_StorageClassSpecifier = 1,
329 PQ_TypeSpecifier = 2,
330 PQ_TypeQualifier = 4,
331 PQ_FunctionSpecifier = 8
337 unsigned StorageClassSpec : 3;
338 unsigned ThreadStorageClassSpec : 2;
339 unsigned SCS_extern_in_linkage_spec : 1;
342 unsigned TypeSpecWidth : 2;
343 unsigned TypeSpecComplex : 2;
344 unsigned TypeSpecSign : 2;
345 unsigned TypeSpecType : 6;
346 unsigned TypeAltiVecVector : 1;
347 unsigned TypeAltiVecPixel : 1;
348 unsigned TypeAltiVecBool : 1;
349 unsigned TypeSpecOwned : 1;
350 unsigned TypeSpecPipe : 1;
351 unsigned TypeSpecSat : 1;
352 unsigned ConstrainedAuto : 1;
355 unsigned TypeQualifiers : 5;
358 unsigned FS_inline_specified : 1;
359 unsigned FS_forceinline_specified: 1;
360 unsigned FS_virtual_specified : 1;
361 unsigned FS_noreturn_specified : 1;
364 unsigned Friend_specified : 1;
367 unsigned ConstexprSpecifier : 2;
398 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
400 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
407 void SaveWrittenBuiltinSpecs();
411 static bool isTypeRep(TST T) {
412 return (T == TST_typename || T == TST_typeofType ||
413 T == TST_underlyingType || T == TST_atomic);
415 static bool isExprRep(TST T) {
416 return (T == TST_typeofExpr || T == TST_decltype);
418 static bool isTemplateIdRep(TST T) {
419 return (T == TST_auto || T == TST_decltype_auto);
423 void operator=(
const DeclSpec &) =
delete;
426 return (T == TST_enum || T == TST_struct ||
427 T == TST_interface || T == TST_union ||
432 : StorageClassSpec(SCS_unspecified),
433 ThreadStorageClassSpec(TSCS_unspecified),
434 SCS_extern_in_linkage_spec(
false), TypeSpecWidth(TSW_unspecified),
435 TypeSpecComplex(TSC_unspecified), TypeSpecSign(TSS_unspecified),
436 TypeSpecType(TST_unspecified), TypeAltiVecVector(
false),
439 TypeQualifiers(TQ_unspecified),
440 FS_inline_specified(
false), FS_forceinline_specified(
false),
441 FS_virtual_specified(
false), FS_noreturn_specified(
false),
443 FS_explicit_specifier(), Attrs(attrFactory), writtenBS(),
444 ObjCQualifiers(nullptr) {}
449 return (TSCS)ThreadStorageClassSpec;
453 SCS_extern_in_linkage_spec =
Value;
458 return ThreadStorageClassSpecLoc;
464 SCS_extern_in_linkage_spec =
false;
471 TypeSpecOwned =
false;
490 assert(isTypeRep((TST) TypeSpecType) &&
"DeclSpec does not store a type");
494 assert(isDeclRep((TST) TypeSpecType) &&
"DeclSpec does not store a decl");
498 assert(isExprRep((TST) TypeSpecType) &&
"DeclSpec does not store an expr");
502 assert(isTemplateIdRep((TST) TypeSpecType) &&
503 "DeclSpec does not store a template id");
504 return TemplateIdRep;
522 assert(isDeclRep((TST) TypeSpecType) || TypeSpecType == TST_typename);
530 return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type ||
531 TypeSpecType == TST_decltype_auto);
534 bool hasTagDefinition()
const;
571 return FS_inline_specified | FS_forceinline_specified;
574 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
578 return FS_explicit_specifier;
589 return FS_explicit_specifier.
getExpr()
590 ?
SourceRange(FS_explicitLoc, FS_explicitCloseParenLoc)
598 FS_inline_specified =
false;
600 FS_forceinline_specified =
false;
602 FS_virtual_specified =
false;
607 FS_noreturn_specified =
false;
614 void forEachCVRUQualifier(
620 void forEachQualifier(
633 unsigned getParsedSpecifiers()
const;
655 const char *&PrevSpec,
unsigned &DiagID,
658 const char *&PrevSpec,
unsigned &DiagID);
659 bool SetTypeSpecWidth(TSW W,
SourceLocation Loc,
const char *&PrevSpec,
661 bool SetTypeSpecComplex(TSC C,
SourceLocation Loc,
const char *&PrevSpec,
663 bool SetTypeSpecSign(TSS S,
SourceLocation Loc,
const char *&PrevSpec,
665 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
667 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
670 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
671 unsigned &DiagID,
Decl *Rep,
bool Owned,
679 unsigned &DiagID,
Decl *Rep,
bool Owned,
681 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
685 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
686 unsigned &DiagID,
Expr *Rep,
688 bool SetTypeAltiVecVector(
bool isAltiVecVector,
SourceLocation Loc,
689 const char *&PrevSpec,
unsigned &DiagID,
692 const char *&PrevSpec,
unsigned &DiagID,
695 const char *&PrevSpec,
unsigned &DiagID,
698 const char *&PrevSpec,
unsigned &DiagID,
702 bool SetTypeSpecError();
704 assert(isDeclRep((TST) TypeSpecType));
708 assert(isTypeRep((TST) TypeSpecType));
712 assert(isExprRep((TST) TypeSpecType));
721 bool setFunctionSpecInline(
SourceLocation Loc,
const char *&PrevSpec,
723 bool setFunctionSpecForceInline(
SourceLocation Loc,
const char *&PrevSpec,
725 bool setFunctionSpecVirtual(
SourceLocation Loc,
const char *&PrevSpec,
727 bool setFunctionSpecExplicit(
SourceLocation Loc,
const char *&PrevSpec,
730 bool setFunctionSpecNoreturn(
SourceLocation Loc,
const char *&PrevSpec,
735 bool setModulePrivateSpec(
SourceLocation Loc,
const char *&PrevSpec,
738 const char *&PrevSpec,
unsigned &DiagID);
809 bool isMissingDeclaratorOk();
830 DQ_CSNullability = 0x40
837 DQ_PR_readonly = 0x01,
840 DQ_PR_readwrite = 0x08,
843 DQ_PR_nonatomic = 0x40,
845 DQ_PR_atomic = 0x100,
847 DQ_PR_strong = 0x400,
848 DQ_PR_unsafe_unretained = 0x800,
849 DQ_PR_nullability = 0x1000,
850 DQ_PR_null_resettable = 0x2000,
851 DQ_PR_class = 0x4000,
852 DQ_PR_direct = 0x8000,
856 : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
857 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
878 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
879 (getPropertyAttributes() & DQ_PR_nullability)) &&
880 "Objective-C declspec doesn't have nullability");
885 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
886 (getPropertyAttributes() & DQ_PR_nullability)) &&
887 "Objective-C declspec doesn't have nullability");
888 return NullabilityLoc;
892 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
893 (getPropertyAttributes() & DQ_PR_nullability)) &&
894 "Set the nullability declspec or property attribute first");
896 NullabilityLoc = loc;
919 unsigned objcDeclQualifier : 7;
922 unsigned PropertyAttributes : 16;
980 unsigned SymbolLocations[3];
992 struct OFI OperatorFunctionId;
1052 StartLocation = EndLocation = IdLoc;
1080 StartLocation = OperatorLoc;
1081 EndLocation = EndLoc;
1082 ConversionFunctionId = Ty;
1097 StartLocation = OpLoc;
1098 EndLocation = IdLoc;
1112 StartLocation = ClassNameLoc;
1113 EndLocation = EndLoc;
1114 ConstructorName = ClassType;
1135 StartLocation = TildeLoc;
1136 EndLocation = EndLoc;
1137 DestructorName = ClassType;
1156 StartLocation = EndLocation = TemplateLoc;
1265 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1266 : Ident(ident), IdentLoc(iloc), Param(param),
1267 DefaultArgTokens(
std::move(DefArgTokens)) {}
1375 for (
unsigned I = 0; I < NumParams; ++I)
1376 Params[I].DefaultArgTokens.reset();
1379 DeleteParams =
false;
1386 delete QualAttrFactory;
1387 delete MethodQualifiers;
1388 switch (getExceptionSpecType()) {
1392 delete[] Exceptions;
1395 delete ExceptionSpecTokens;
1398 if (NumExceptionsOrDecls != 0)
1399 delete[] DeclsInPrototype;
1405 if (!MethodQualifiers) {
1407 MethodQualifiers =
new DeclSpec(*QualAttrFactory);
1409 return *MethodQualifiers;
1438 return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd());
1448 assert(MethodQualifiers);
1454 assert(MethodQualifiers);
1460 assert(MethodQualifiers);
1490 assert(ExceptionSpecType !=
EST_None);
1491 return NumExceptionsOrDecls;
1497 assert(ExceptionSpecType ==
EST_None);
1498 return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1528 return *
reinterpret_cast<const CXXScopeSpec *
>(ScopeMem);
1531 Scope().~CXXScopeSpec();
1602 bool isStatic,
bool isStar,
Expr *NumElts,
1623 bool RefQualifierIsLvalueRef,
1630 unsigned NumExceptions,
1632 CachedTokens *ExceptionSpecTokens,
1639 DeclSpec *MethodQualifiers =
nullptr);
1645 I.
Kind = BlockPointer;
1665 I.
Kind = MemberPointer;
1684 return Kind ==
Paren;
1703 unsigned NumBindings : 31;
1704 unsigned DeleteBindings : 1;
1710 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1724 DeleteBindings =
false;
1728 return llvm::makeArrayRef(Bindings, NumBindings);
1813 unsigned InvalidType : 1;
1816 unsigned GroupingParens : 1;
1822 unsigned FunctionDefinition : 2;
1825 unsigned Redeclaration : 1;
1828 unsigned Extension : 1;
1831 unsigned ObjCIvar : 1;
1834 unsigned ObjCWeakProperty : 1;
1837 unsigned InlineStorageUsed : 1;
1847 Expr *TrailingRequiresClause;
1882 InvalidType(DS.getTypeSpecType() ==
DeclSpec::TST_error),
1885 ObjCWeakProperty(
false), InlineStorageUsed(
false),
1886 Attrs(ds.getAttributePool().getFactory()), AsmLabel(nullptr),
1887 TrailingRequiresClause(nullptr),
1888 InventedTemplateParameterList(nullptr) {}
1917 return BindingGroup;
1962 BindingGroup.
clear();
1964 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1965 DeclTypeInfo[i].destroy();
1966 DeclTypeInfo.clear();
1969 InlineStorageUsed =
false;
1971 ObjCWeakProperty =
false;
2012 llvm_unreachable(
"unknown context kind!");
2051 llvm_unreachable(
"unknown context kind!");
2094 llvm_unreachable(
"unknown context kind!");
2100 if (hasGroupingParens())
return false;
2150 llvm_unreachable(
"unknown context kind!");
2164 Name.
Identifier || isDecompositionDeclarator();
2169 return BindingGroup.
isSet();
2197 DeclTypeInfo.push_back(TI);
2198 DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2199 getAttributePool().takeAllFrom(attrs.getPool());
2202 SetRangeEnd(EndLoc);
2208 DeclTypeInfo.push_back(TI);
2211 SetRangeEnd(EndLoc);
2216 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2225 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2226 return DeclTypeInfo[i];
2229 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2230 return DeclTypeInfo[i];
2238 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2242 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2243 DeclTypeInfo.front().destroy();
2244 DeclTypeInfo.erase(DeclTypeInfo.begin());
2251 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2252 if (!DeclTypeInfo[i].isParen())
2253 return &DeclTypeInfo[i];
2262 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2263 if (!DeclTypeInfo[i-1].isParen())
2264 return &DeclTypeInfo[i-1];
2283 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2284 switch (DeclTypeInfo[i].Kind) {
2298 llvm_unreachable(
"Invalid type chunk");
2308 return isFunctionDeclarator(index);
2314 assert(isFunctionDeclarator() &&
"Not a function declarator!");
2316 isFunctionDeclarator(index);
2317 return DeclTypeInfo[index].Fun;
2323 return const_cast<Declarator*
>(
this)->getFunctionTypeInfo();
2332 bool isDeclarationOfFunction()
const;
2372 llvm_unreachable(
"unknown context kind!");
2414 llvm_unreachable(
"unknown context kind!");
2420 if (!isFunctionDeclarationContext())
2423 for (
unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2433 for (
const auto &Chunk : type_objects())
2435 Chunk.Fun.hasTrailingReturnType())
2442 TrailingRequiresClause = TRC;
2447 return TrailingRequiresClause;
2453 return TrailingRequiresClause !=
nullptr;
2458 TemplateParameterLists = TPLs;
2463 return TemplateParameterLists;
2470 InventedTemplateParameterList = Invented;
2477 return InventedTemplateParameterList;
2493 SetRangeEnd(lastLoc);
2501 if (!getAttributes().empty() || getDeclSpec().hasAttributes())
2503 for (
unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
2504 if (!getTypeObject(i).getAttrs().empty())
2513 if (AL.isCXX11Attribute())
2514 Ranges.push_back(AL.getRange());
2546 FunctionDefinition = Val;
2560 !getDeclSpec().isFriendSpecified();
2566 bool isStaticMember();
2569 bool isCtorOrDtor();
2582 BitfieldSize(nullptr) {}
2600 const char *&PrevSpec);
2613 static const char *getSpecifierName(
Specifier VS);
2620 unsigned Specifiers;
2653 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2654 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType),
2655 ExplicitRange(ExplicitRange) {}
2675 Captures.push_back(
LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2676 InitCaptureType, ExplicitRange));
2684 unsigned NumExplicitTemplateParams = 0;
2688 unsigned AutoTemplateParameterDepth = 0;
2702 #endif // LLVM_CLANG_SEMA_DECLSPEC_H
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
void ClearFunctionSpecs()
AttributePool & getAttributePool() 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.
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.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
no exception specification
void setKind(UnqualifiedIdKind kind)
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void clear()
Reset the contents of this Declarator.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
ObjCDeclQualifier getObjCDeclQualifier() const
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
ThreadStorageClassSpecifier TSCS
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.
bool isEmpty() const
No scope specifier.
void setEndLoc(SourceLocation Loc)
void setPropertyAttributes(ObjCPropertyAttributeKind PRVal)
Decl - This represents one declaration (or definition), e.g.
unsigned ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
Captures information about "declaration specifiers" specific to Objective-C.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
unsigned EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
bool isOverrideSpecified() const
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier.
A constructor named via a template-id.
SourceLocation getLParenLoc() const
Declarator(const DeclSpec &ds, DeclaratorContext C)
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
SourceLocation getBeginLoc() const LLVM_READONLY
One instance of this struct is used for each type in a declarator that is parsed. ...
Represent a C++ namespace.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
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...
SourceLocation getEndLoc() const LLVM_READONLY
LambdaCaptureInitKind InitKind
bool isTypeSpecSat() const
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template...
Store information needed for an explicit specifier.
bool hasExplicitSpecifier() const
An overloaded operator name, e.g., operator+.
TSCS getThreadStorageClassSpec() const
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void SetIdentifier(IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
SourceLocation getEndLoc() const
unsigned RefQualifierLoc
The location of the ref-qualifier, if any.
SourceLocation getEllipsisLoc() const
const ParsedAttributes & getAttributes() const
SourceLocation getOverrideLoc() const
unsigned RestrictQualLoc
The location of the restrict-qualifier, if any.
bool isKNRPrototype() const
isKNRPrototype - Return true if this is a K&R style identifier list, like "void foo(a,b,c)".
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
std::pair< char *, unsigned > getBuffer() const
Retrieve the underlying buffer.
static const TSCS TSCS_unspecified
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
void setObjCQualifiers(ObjCDeclSpec *quals)
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
Information about one declarator, including the parsed type information and the identifier.
void setTypeofParensRange(SourceRange range)
ObjCDeclSpec * getObjCQualifiers() const
TypeSpecifierType
Specifies the kind of type.
TemplateIdAnnotation * TemplateIdRep
SourceLocation getFinalLoc() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setBegin(SourceLocation b)
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
Describes how types, statements, expressions, and declarations should be printed. ...
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
const IdentifierInfo * getSetterName() const
void setTrailingRequiresClause(Expr *TRC)
Sets a trailing requires clause for this declarator.
bool mayOmitIdentifier() const
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
Information about a template-id annotation token.
IdentifierInfo * getGetterName()
SourceRange getTypeSpecWidthRange() const
Base wrapper for a particular "section" of type source info.
SourceLocation getFriendSpecLoc() const
bool isRedeclaration() const
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.
SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
SourceLocation getSetterNameLoc() const
SourceLocation getExceptionSpecLocBeg() const
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
SourceLocation getEndLoc() const LLVM_READONLY
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 getTypeSpecTypeLoc() const
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
DeclSpec(AttributeFactory &attrFactory)
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.
bool isFunctionDefinition() const
bool hasAutoTypeSpec() const
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
static const TST TST_error
ExplicitSpecifier getExplicitSpecifier() const
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.
TSC getTypeSpecComplex() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier.
A user-defined literal name, e.g., operator "" _i.
void SetSourceRange(SourceRange R)
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
bool isInvalidType() const
void setTemplateParameterLists(ArrayRef< TemplateParameterList *> TPLs)
Sets the template parameter lists that preceded the declarator.
bool isFinalSpelledSealed() const
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.
bool isFunctionDeclaratorAFunctionDeclaration() const
Return true if a function declarator at this position would be a function declaration.
unsigned ConstQualLoc
The location of the const-qualifier, if any.
void setExtension(bool Val=true)
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
ParamInfo(IdentifierInfo *ident, SourceLocation iloc, Decl *param, std::unique_ptr< CachedTokens > DefArgTokens=nullptr)
void SetRangeBegin(SourceLocation Loc)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
bool isTypeSpecPipe() const
SCS
storage-class-specifier
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
void setRedeclaration(bool Val)
const ParsedAttributes & getAttributes() const
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.
TSS getTypeSpecSign() const
bool hasAttributes() const
ActionResult< ParsedType > TypeResult
unsigned RParenLoc
The location of the right parenthesis in the source.
Scope - A scope is a transient data structure that is used while parsing the program.
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNoreturnSpecified() const
void UpdateExprRep(Expr *Rep)
SourceLocation getConstSpecLoc() const
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
SourceLocation getLSquareLoc() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
IdentifierInfo * getIdentifier() const
DeclSpec & getOrCreateMethodQualifiers()
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced...
Class that aids in the construction of nested-name-specifiers along with source-location information ...
bool isExpressionContext() const
Determine whether this declaration appears in a context where an expression could appear...
bool isExternInLinkageSpec() const
bool isFinalSpecified() const
SourceLocation getTypeSpecComplexLoc() const
unsigned AccessWrites
The access writes.
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
SourceLocation getAltiVecLoc() const
Sema - This implements semantic analysis and AST building for C.
SourceLocation getUnalignedSpecLoc() const
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
bool hasConstexprSpecifier() const
void setSetterName(IdentifierInfo *name, SourceLocation loc)
void ClearConstexprSpec()
bool mayBeFollowedByCXXDirectInit() const
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initiali...
bool isTypeAltiVecPixel() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear...
IdentifierInfo * getSetterName()
void SetRangeStart(SourceLocation Loc)
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
Append a capture in a lambda introducer.
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
bool getExtension() const
bool mayHaveDecompositionDeclarator() const
Return true if the context permits a C++17 decomposition declarator.
A conversion function name, e.g., operator int.
SourceRange getRange() const
SmallVector< LambdaCapture, 4 > Captures
TST getTypeSpecType() const
static bool isDeclRep(TST T)
ParsedAttributes & getAttributes()
llvm::iterator_range< type_object_iterator > type_object_range
SourceRange getSourceRange() const
unsigned hasStatic
True if this dimension included the 'static' keyword.
This represents one expression.
void setDeductionGuideName(ParsedTemplateTy Template, SourceLocation TemplateLoc)
Specify that this unqualified-id was parsed as a template-name for a deduction-guide.
UnqualifiedIdKind
Describes the kind of unqualified-id parsed.
bool isDecompositionDeclarator() const
Return whether this declarator is a decomposition declarator.
An individual capture in a lambda introducer.
DeclaratorChunk & getTypeObject(unsigned i)
unsigned VolatileQualLoc
The location of the volatile-qualifier, if any.
static DeclaratorChunk getPipe(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
Specifier getLastSpecifier() const
bool isTypeAltiVecVector() const
void freeParams()
Reset the parameter list to having zero parameters.
SourceLocation getVolatileSpecLoc() const
SourceLocation getThreadStorageClassSpecLoc() const
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)
const DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo() const
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
SourceLocation getBeginLoc() const
A parsed C++17 decomposition declarator of the form '[' identifier-list ']'.
SourceLocation EllipsisLoc
void addAll(iterator B, iterator E)
Represents a C++ template name within the type system.
const Expr * getExpr() const
SourceLocation getStorageClassSpecLoc() const
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
void UpdateTypeRep(ParsedType Rep)
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed...
bool hasAttributes() const
hasAttributes - do we contain any attributes?
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
SourceLocation Loc
Loc - The place where this type was defined.
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
Specific that this unqualified-id was parsed as a literal-operator-id.
void setEllipsisLoc(SourceLocation EL)
SourceLocation getEnd() const
ParsedAttributesView AttrList
ParsedType InitCaptureType
const DeclaratorChunk * getOutermostNonParenChunk() const
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chu...
bool isFriendSpecified() const
Wraps an identifier and optional source location for the identifier.
SourceLocation getCommaLoc() const
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
bool isFirstDeclarator() const
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
SourceLocation getRSquareLoc() const
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
NullabilityKind getNullability() const
bool hasGroupingParens() const
ConstexprSpecKind getConstexprSpecifier() const
SourceLocation getNoreturnSpecLoc() const
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
ParsedAttributesView & getAttrs()
static DeclaratorChunk getParen(SourceLocation LParenLoc, SourceLocation RParenLoc)
Return a DeclaratorChunk for a paren.
char * location_data() const
Retrieve the data associated with the source-location information.
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
UnqualifiedIdKind Kind
Describes the kind of unqualified-id parsed.
SourceLocation DefaultLoc
bool isArrayOfUnknownBound() const
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of un...
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.
SCS getStorageClassSpec() const
SourceLocation getRParenLoc() const
Expr * getAsmLabel() const
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
Encodes a location in the source.
bool isTypeSpecOwned() const
ParsedSpecifiers
ParsedSpecifiers - Flags to query which specifiers were applied.
FunctionDefinitionKind getFunctionDefinitionKind() const
enum clang::DeclaratorChunk::@219 Kind
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
bool isModulePrivateSpecified() const
SourceLocation getEndLoc() const LLVM_READONLY
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
ParsedAttr - Represents a syntactic attribute.
bool hasTrailingRequiresClause() const
Determine whether a trailing requires clause was written in this declarator.
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
char ScopeMem[sizeof(CXXScopeSpec)]
const DecompositionDeclarator & getDecompositionDeclarator() const
void setGroupingParens(bool flag)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
AttributeFactory * QualAttrFactory
AtttibuteFactory for the MethodQualifiers.
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
ObjCPropertyAttributeKind getPropertyAttributes() const
MemberPointerTypeInfo Mem
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
Decl * getRepAsDecl() const
Represents a C++11 virt-specifier-seq.
void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
FunctionDefinitionKind
Described the kind of function definition (if any) provided for a function.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier.
SourceLocation getInlineSpecLoc() const
static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
SourceLocation getLastLocation() const
Defines various enumerations that describe declaration and type specifiers.
SourceLocation getModulePrivateSpecLoc() const
bool isObjCWeakProperty() const
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...
TSW getTypeSpecWidth() const
Dataflow Directional Tag Classes.
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
ConstexprSpecKind
Define the kind of constexpr specifier.
bool isValid() const
Return true if this is a valid SourceLocation object.
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
FieldDeclarator(const DeclSpec &DS)
static const TSS TSS_unspecified
SourceLocation getTypeSpecWidthLoc() const
LambdaCaptureDefault Default
DecompositionDeclarator()
void setObjCIvar(bool Val=true)
SourceLocation getTypeSpecSatLoc() const
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk...
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
SourceLocation getPipeLoc() const
SourceLocation getTypeSpecSignLoc() const
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
SourceRange ExplicitRange
bool isTypeAltiVecBool() const
SourceLocation getBeginLoc() const LLVM_READONLY
static const TST TST_unspecified
bool isValid() const
A scope specifier is present, and it refers to a real scope.
const CXXScopeSpec & getTypeSpecScope() const
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
void takeAttributesFrom(ParsedAttributes &attrs)
SourceLocation getNullabilityLoc() const
SourceLocation getVirtualSpecLoc() const
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
TemplateIdAnnotation * getRepAsTemplateId() const
SourceLocation getGetterNameLoc() const
unsigned LParenLoc
The location of the left parenthesis in the source.
void setNullability(SourceLocation loc, NullabilityKind kind)
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
The template parameter lists that preceded the declarator.
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.
unsigned AtomicQualLoc
The location of the _Atomic-qualifier, if any.
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
SourceLocation getTypeSpecTypeNameLoc() const
CXXScopeSpec & getTypeSpecScope()
SourceRange getExceptionSpecRange() const
SourceLocation getIdentifierLoc() const
Structure that packs information about the type specifiers that were written in a particular type spe...
bool isSet() const
Deprecated.
void getCXX11AttributeRanges(SmallVectorImpl< SourceRange > &Ranges)
Return a source range list of C++11 attributes associated with the declarator.
SourceRange getSourceRange() const
void setInvalidType(bool Val=true)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
unsigned TypeQuals
For now, sema will catch these as invalid.
static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
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...
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
const CXXScopeSpec & Scope() const
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Captures information about "declaration specifiers".
SourceLocation getRestrictSpecLoc() 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...
SourceLocation getEllipsisLoc() const
TemplateParameterList * getInventedTemplateParameterList() const
The template parameter list generated from the explicit template parameters along with any invented t...
SourceLocation getMutableLoc() const
Retrieve the location of the 'mutable' qualifier, if any.
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.
bool mayHaveIdentifier() const
mayHaveIdentifier - Return true if the identifier is either optional or required. ...
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
bool isVirtualSpecified() const
unsigned kind
All of the diagnostics that can be emitted by the frontend.
void setInventedTemplateParameterList(TemplateParameterList *Invented)
Sets the template parameter list generated from the explicit template parameters along with any inven...
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
bool isSpecified() const
Determine if the declaration had an explicit specifier of any kind.
A template-id, e.g., f<int>.
SourceLocation getFirstLocation() const
AttributePool & getPool() const
ParsedType getRepAsType() const
bool isInlineSpecified() 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.
SourceLocation getAtomicSpecLoc() const
void setBeginLoc(SourceLocation Loc)
SourceLocation getExplicitSpecLoc() const
SourceLocation getConstexprSpecLoc() const
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
ArrayRef< NamedDecl * > getDeclsInPrototype() const
Get the non-parameter decls defined within this function prototype.
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
const IdentifierInfo * getGetterName() const
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
ArrayRef< Binding > bindings() const
DeclaratorContext getContext() const
SourceLocation getExceptionSpecLocEnd() const
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
unsigned ExceptionSpecLocEnd
The end location of the exception specification, if any.
bool isConstrainedAuto() const
Expr * getRepAsExpr() 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.
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.
void SetRangeEnd(SourceLocation Loc)
bool isPrototypeContext() const
void addAttributes(ParsedAttributesView &AL)
Concatenates two attribute lists.
AttributePool & getAttributePool() const
SourceLocation getBegin() const
ParsedAttributes - A collection of parsed attributes.
void setCommaLoc(SourceLocation CL)
An implicit 'self' parameter.
SourceRange getExplicitSpecRange() const
~DecompositionDeclarator()
A deduction-guide name (a template-name)
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedAttributes & getAttributes()
SourceRange getTypeofParensRange() const
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)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?