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");
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;
354 unsigned TypeQualifiers : 5;
357 unsigned FS_inline_specified : 1;
358 unsigned FS_forceinline_specified: 1;
359 unsigned FS_virtual_specified : 1;
360 unsigned FS_explicit_specified : 1;
361 unsigned FS_noreturn_specified : 1;
364 unsigned Friend_specified : 1;
367 unsigned Constexpr_specified : 1;
394 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
396 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
402 void SaveWrittenBuiltinSpecs();
406 static bool isTypeRep(TST T) {
407 return (T == TST_typename || T == TST_typeofType ||
408 T == TST_underlyingType || T == TST_atomic);
410 static bool isExprRep(TST T) {
411 return (T == TST_typeofExpr || T == TST_decltype);
415 void operator=(
const DeclSpec &) =
delete;
418 return (T == TST_enum || T == TST_struct ||
419 T == TST_interface || T == TST_union ||
424 : StorageClassSpec(SCS_unspecified),
425 ThreadStorageClassSpec(TSCS_unspecified),
426 SCS_extern_in_linkage_spec(
false),
427 TypeSpecWidth(TSW_unspecified),
428 TypeSpecComplex(TSC_unspecified),
429 TypeSpecSign(TSS_unspecified),
430 TypeSpecType(TST_unspecified),
431 TypeAltiVecVector(
false),
432 TypeAltiVecPixel(
false),
433 TypeAltiVecBool(
false),
434 TypeSpecOwned(
false),
437 TypeQualifiers(TQ_unspecified),
438 FS_inline_specified(
false),
439 FS_forceinline_specified(
false),
440 FS_virtual_specified(
false),
441 FS_explicit_specified(
false),
442 FS_noreturn_specified(
false),
443 Friend_specified(
false),
444 Constexpr_specified(
false),
447 ObjCQualifiers(nullptr) {
453 return (TSCS)ThreadStorageClassSpec;
457 SCS_extern_in_linkage_spec =
Value;
462 return ThreadStorageClassSpecLoc;
468 SCS_extern_in_linkage_spec =
false;
475 TypeSpecOwned =
false;
493 assert(isTypeRep((TST) TypeSpecType) &&
"DeclSpec does not store a type");
497 assert(isDeclRep((TST) TypeSpecType) &&
"DeclSpec does not store a decl");
501 assert(isExprRep((TST) TypeSpecType) &&
"DeclSpec does not store an expr");
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;
570 return FS_inline_specified | FS_forceinline_specified;
573 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
586 FS_inline_specified =
false;
588 FS_forceinline_specified =
false;
590 FS_virtual_specified =
false;
592 FS_explicit_specified =
false;
594 FS_noreturn_specified =
false;
608 unsigned getParsedSpecifiers()
const;
630 const char *&PrevSpec,
unsigned &DiagID,
633 const char *&PrevSpec,
unsigned &DiagID);
634 bool SetTypeSpecWidth(TSW W,
SourceLocation Loc,
const char *&PrevSpec,
636 bool SetTypeSpecComplex(TSC C,
SourceLocation Loc,
const char *&PrevSpec,
638 bool SetTypeSpecSign(TSS S,
SourceLocation Loc,
const char *&PrevSpec,
640 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
642 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
645 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
646 unsigned &DiagID,
Decl *Rep,
bool Owned,
654 unsigned &DiagID,
Decl *Rep,
bool Owned,
657 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
658 unsigned &DiagID,
Expr *Rep,
660 bool SetTypeAltiVecVector(
bool isAltiVecVector,
SourceLocation Loc,
661 const char *&PrevSpec,
unsigned &DiagID,
664 const char *&PrevSpec,
unsigned &DiagID,
667 const char *&PrevSpec,
unsigned &DiagID,
670 const char *&PrevSpec,
unsigned &DiagID,
674 bool SetTypeSpecError();
676 assert(isDeclRep((TST) TypeSpecType));
680 assert(isTypeRep((TST) TypeSpecType));
684 assert(isExprRep((TST) TypeSpecType));
691 bool setFunctionSpecInline(
SourceLocation Loc,
const char *&PrevSpec,
693 bool setFunctionSpecForceInline(
SourceLocation Loc,
const char *&PrevSpec,
695 bool setFunctionSpecVirtual(
SourceLocation Loc,
const char *&PrevSpec,
697 bool setFunctionSpecExplicit(
SourceLocation Loc,
const char *&PrevSpec,
699 bool setFunctionSpecNoreturn(
SourceLocation Loc,
const char *&PrevSpec,
704 bool setModulePrivateSpec(
SourceLocation Loc,
const char *&PrevSpec,
719 Constexpr_specified =
false;
772 bool isMissingDeclaratorOk();
793 DQ_CSNullability = 0x40
800 DQ_PR_readonly = 0x01,
803 DQ_PR_readwrite = 0x08,
806 DQ_PR_nonatomic = 0x40,
808 DQ_PR_atomic = 0x100,
810 DQ_PR_strong = 0x400,
811 DQ_PR_unsafe_unretained = 0x800,
812 DQ_PR_nullability = 0x1000,
813 DQ_PR_null_resettable = 0x2000,
818 : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
819 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
840 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
841 (getPropertyAttributes() & DQ_PR_nullability)) &&
842 "Objective-C declspec doesn't have nullability");
847 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
848 (getPropertyAttributes() & DQ_PR_nullability)) &&
849 "Objective-C declspec doesn't have nullability");
850 return NullabilityLoc;
854 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
855 (getPropertyAttributes() & DQ_PR_nullability)) &&
856 "Set the nullability declspec or property attribute first");
858 NullabilityLoc = loc;
881 unsigned objcDeclQualifier : 7;
884 unsigned PropertyAttributes : 15;
942 unsigned SymbolLocations[3];
954 struct OFI OperatorFunctionId;
992 Identifier =
nullptr;
1014 StartLocation = EndLocation = IdLoc;
1042 StartLocation = OperatorLoc;
1043 EndLocation = EndLoc;
1044 ConversionFunctionId = Ty;
1059 StartLocation = OpLoc;
1060 EndLocation = IdLoc;
1074 StartLocation = ClassNameLoc;
1075 EndLocation = EndLoc;
1076 ConstructorName = ClassType;
1097 StartLocation = TildeLoc;
1098 EndLocation = EndLoc;
1099 DestructorName = ClassType;
1118 StartLocation = EndLocation = TemplateLoc;
1229 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1230 : Ident(ident), IdentLoc(iloc), Param(param),
1231 DefaultArgTokens(
std::move(DefArgTokens)) {}
1352 for (
unsigned I = 0; I < NumParams; ++I)
1353 Params[I].DefaultArgTokens.reset();
1356 DeleteParams =
false;
1363 switch (getExceptionSpecType()) {
1367 delete[] Exceptions;
1370 delete ExceptionSpecTokens;
1373 if (NumExceptionsOrDecls != 0)
1374 delete[] DeclsInPrototype;
1405 return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd());
1448 assert(ExceptionSpecType !=
EST_None);
1449 return NumExceptionsOrDecls;
1455 assert(ExceptionSpecType ==
EST_None);
1456 return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1486 return *
reinterpret_cast<const CXXScopeSpec *
>(ScopeMem);
1489 Scope().~CXXScopeSpec();
1560 bool isStatic,
bool isStar,
Expr *NumElts,
1582 bool RefQualifierIsLvalueRef,
1592 unsigned NumExceptions,
1594 CachedTokens *ExceptionSpecTokens,
1606 I.
Kind = BlockPointer;
1626 I.
Kind = MemberPointer;
1645 return Kind ==
Paren;
1664 unsigned NumBindings : 31;
1665 unsigned DeleteBindings : 1;
1671 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1685 DeleteBindings =
false;
1689 return llvm::makeArrayRef(Bindings, NumBindings);
1773 unsigned InvalidType : 1;
1776 unsigned GroupingParens : 1;
1782 unsigned FunctionDefinition : 2;
1785 unsigned Redeclaration : 1;
1788 unsigned Extension : 1;
1791 unsigned ObjCIvar : 1;
1794 unsigned ObjCWeakProperty : 1;
1797 unsigned InlineStorageUsed : 1;
1830 InvalidType(DS.getTypeSpecType() ==
DeclSpec::TST_error),
1833 ObjCWeakProperty(
false), InlineStorageUsed(
false),
1834 Attrs(ds.getAttributePool().getFactory()), AsmLabel(nullptr) {}
1863 return BindingGroup;
1910 BindingGroup.
clear();
1912 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1913 DeclTypeInfo[i].destroy();
1914 DeclTypeInfo.clear();
1917 InlineStorageUsed =
false;
1919 ObjCWeakProperty =
false;
1959 llvm_unreachable(
"unknown context kind!");
1997 llvm_unreachable(
"unknown context kind!");
2039 llvm_unreachable(
"unknown context kind!");
2045 if (hasGroupingParens())
return false;
2094 llvm_unreachable(
"unknown context kind!");
2108 Name.
Identifier || isDecompositionDeclarator();
2113 return BindingGroup.
isSet();
2141 DeclTypeInfo.push_back(TI);
2142 DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2143 getAttributePool().takeAllFrom(attrs.getPool());
2146 SetRangeEnd(EndLoc);
2152 DeclTypeInfo.push_back(TI);
2155 SetRangeEnd(EndLoc);
2160 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2169 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2170 return DeclTypeInfo[i];
2173 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2174 return DeclTypeInfo[i];
2182 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2186 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2187 DeclTypeInfo.front().destroy();
2188 DeclTypeInfo.erase(DeclTypeInfo.begin());
2195 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2196 if (!DeclTypeInfo[i].isParen())
2197 return &DeclTypeInfo[i];
2206 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2207 if (!DeclTypeInfo[i-1].isParen())
2208 return &DeclTypeInfo[i-1];
2227 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2228 switch (DeclTypeInfo[i].Kind) {
2242 llvm_unreachable(
"Invalid type chunk");
2252 return isFunctionDeclarator(index);
2258 assert(isFunctionDeclarator() &&
"Not a function declarator!");
2260 isFunctionDeclarator(index);
2261 return DeclTypeInfo[index].Fun;
2267 return const_cast<Declarator*
>(
this)->getFunctionTypeInfo();
2276 bool isDeclarationOfFunction()
const;
2315 llvm_unreachable(
"unknown context kind!");
2356 llvm_unreachable(
"unknown context kind!");
2362 if (!isFunctionDeclarationContext())
2365 for (
unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2375 for (
const auto &Chunk : type_objects())
2377 Chunk.Fun.hasTrailingReturnType())
2395 SetRangeEnd(lastLoc);
2403 if (!getAttributes().empty() || getDeclSpec().hasAttributes())
2405 for (
unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
2406 if (!getTypeObject(i).getAttrs().empty())
2415 if (AL.isCXX11Attribute())
2416 Ranges.push_back(AL.getRange());
2448 FunctionDefinition = Val;
2462 !getDeclSpec().isFriendSpecified();
2468 bool isStaticMember();
2471 bool isCtorOrDtor();
2484 BitfieldSize(nullptr) {}
2502 const char *&PrevSpec);
2515 static const char *getSpecifierName(
Specifier VS);
2522 unsigned Specifiers;
2555 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2556 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType),
2557 ExplicitRange(ExplicitRange) {}
2577 Captures.push_back(
LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2578 InitCaptureType, ExplicitRange));
2584 #endif // LLVM_CLANG_SEMA_DECLSPEC_H
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
SourceLocation getLocEnd() const LLVM_READONLY
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
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 & 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, if any.
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...
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.
SourceLocation getFinalLoc() const
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. ...
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
const IdentifierInfo * getSetterName() const
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.
unsigned VolatileQualifierLoc
The location of the volatile-qualifier, if any.
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.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned The qualifier bitmask values are the same as...
bool isFunctionDefinition() const
bool hasAutoTypeSpec() const
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
static const TST TST_error
SourceLocation getLocStart() const LLVM_READONLY
static const TSW TSW_unspecified
void ClearStorageClassSpecs()
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
Return a DeclaratorChunk for a pointer.
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, if any.
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
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.
SourceLocation getLocStart() const LLVM_READONLY
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.
enum clang::DeclaratorChunk::@196 Kind
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
SourceLocation getLocStart() const LLVM_READONLY
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
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.
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.
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.
Expr - 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.
bool isExplicitSpecified() const
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
bool isConstexprSpecified() 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.
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
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
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.
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>::".
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, if any.
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.
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
unsigned ConstQualifierLoc
The location of the const-qualifier, if any.
SourceLocation getTypeSpecSignLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
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.
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.
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)
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...
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
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 MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
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.
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.
SourceLocation getLocEnd() const LLVM_READONLY
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.
~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?