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;
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_noreturn_specified : 1;
363 unsigned Friend_specified : 1;
366 unsigned ConstexprSpecifier : 2;
396 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
398 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
405 void SaveWrittenBuiltinSpecs();
409 static bool isTypeRep(TST T) {
410 return (T == TST_typename || T == TST_typeofType ||
411 T == TST_underlyingType || T == TST_atomic);
413 static bool isExprRep(TST T) {
414 return (T == TST_typeofExpr || T == TST_decltype);
418 void operator=(
const DeclSpec &) =
delete;
421 return (T == TST_enum || T == TST_struct ||
422 T == TST_interface || T == TST_union ||
427 : StorageClassSpec(SCS_unspecified),
428 ThreadStorageClassSpec(TSCS_unspecified),
429 SCS_extern_in_linkage_spec(
false), TypeSpecWidth(TSW_unspecified),
430 TypeSpecComplex(TSC_unspecified), TypeSpecSign(TSS_unspecified),
431 TypeSpecType(TST_unspecified), TypeAltiVecVector(
false),
433 TypeSpecPipe(
false), TypeSpecSat(
false), TypeQualifiers(TQ_unspecified),
434 FS_inline_specified(
false), FS_forceinline_specified(
false),
435 FS_virtual_specified(
false), FS_noreturn_specified(
false),
437 FS_explicit_specifier(), Attrs(attrFactory), writtenBS(),
438 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;
483 assert(isTypeRep((TST) TypeSpecType) &&
"DeclSpec does not store a type");
487 assert(isDeclRep((TST) TypeSpecType) &&
"DeclSpec does not store a decl");
491 assert(isExprRep((TST) TypeSpecType) &&
"DeclSpec does not store an expr");
510 assert(isDeclRep((TST) TypeSpecType) || TypeSpecType == TST_typename);
518 return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type ||
519 TypeSpecType == TST_decltype_auto);
522 bool hasTagDefinition()
const;
559 return FS_inline_specified | FS_forceinline_specified;
562 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
566 return FS_explicit_specifier;
577 return FS_explicit_specifier.
getExpr()
578 ?
SourceRange(FS_explicitLoc, FS_explicitCloseParenLoc)
586 FS_inline_specified =
false;
588 FS_forceinline_specified =
false;
590 FS_virtual_specified =
false;
595 FS_noreturn_specified =
false;
602 void forEachCVRUQualifier(
608 void forEachQualifier(
621 unsigned getParsedSpecifiers()
const;
643 const char *&PrevSpec,
unsigned &DiagID,
646 const char *&PrevSpec,
unsigned &DiagID);
647 bool SetTypeSpecWidth(TSW W,
SourceLocation Loc,
const char *&PrevSpec,
649 bool SetTypeSpecComplex(TSC C,
SourceLocation Loc,
const char *&PrevSpec,
651 bool SetTypeSpecSign(TSS S,
SourceLocation Loc,
const char *&PrevSpec,
653 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
655 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
658 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
659 unsigned &DiagID,
Decl *Rep,
bool Owned,
667 unsigned &DiagID,
Decl *Rep,
bool Owned,
670 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
671 unsigned &DiagID,
Expr *Rep,
673 bool SetTypeAltiVecVector(
bool isAltiVecVector,
SourceLocation Loc,
674 const char *&PrevSpec,
unsigned &DiagID,
677 const char *&PrevSpec,
unsigned &DiagID,
680 const char *&PrevSpec,
unsigned &DiagID,
683 const char *&PrevSpec,
unsigned &DiagID,
687 bool SetTypeSpecError();
689 assert(isDeclRep((TST) TypeSpecType));
693 assert(isTypeRep((TST) TypeSpecType));
697 assert(isExprRep((TST) TypeSpecType));
706 bool setFunctionSpecInline(
SourceLocation Loc,
const char *&PrevSpec,
708 bool setFunctionSpecForceInline(
SourceLocation Loc,
const char *&PrevSpec,
710 bool setFunctionSpecVirtual(
SourceLocation Loc,
const char *&PrevSpec,
712 bool setFunctionSpecExplicit(
SourceLocation Loc,
const char *&PrevSpec,
715 bool setFunctionSpecNoreturn(
SourceLocation Loc,
const char *&PrevSpec,
720 bool setModulePrivateSpec(
SourceLocation Loc,
const char *&PrevSpec,
723 const char *&PrevSpec,
unsigned &DiagID);
794 bool isMissingDeclaratorOk();
815 DQ_CSNullability = 0x40
822 DQ_PR_readonly = 0x01,
825 DQ_PR_readwrite = 0x08,
828 DQ_PR_nonatomic = 0x40,
830 DQ_PR_atomic = 0x100,
832 DQ_PR_strong = 0x400,
833 DQ_PR_unsafe_unretained = 0x800,
834 DQ_PR_nullability = 0x1000,
835 DQ_PR_null_resettable = 0x2000,
840 : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
841 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
862 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
863 (getPropertyAttributes() & DQ_PR_nullability)) &&
864 "Objective-C declspec doesn't have nullability");
869 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
870 (getPropertyAttributes() & DQ_PR_nullability)) &&
871 "Objective-C declspec doesn't have nullability");
872 return NullabilityLoc;
876 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
877 (getPropertyAttributes() & DQ_PR_nullability)) &&
878 "Set the nullability declspec or property attribute first");
880 NullabilityLoc = loc;
903 unsigned objcDeclQualifier : 7;
906 unsigned PropertyAttributes : 15;
964 unsigned SymbolLocations[3];
976 struct OFI OperatorFunctionId;
1036 StartLocation = EndLocation = IdLoc;
1064 StartLocation = OperatorLoc;
1065 EndLocation = EndLoc;
1066 ConversionFunctionId = Ty;
1081 StartLocation = OpLoc;
1082 EndLocation = IdLoc;
1096 StartLocation = ClassNameLoc;
1097 EndLocation = EndLoc;
1098 ConstructorName = ClassType;
1119 StartLocation = TildeLoc;
1120 EndLocation = EndLoc;
1121 DestructorName = ClassType;
1140 StartLocation = EndLocation = TemplateLoc;
1249 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1250 : Ident(ident), IdentLoc(iloc), Param(param),
1251 DefaultArgTokens(
std::move(DefArgTokens)) {}
1359 for (
unsigned I = 0; I < NumParams; ++I)
1360 Params[I].DefaultArgTokens.reset();
1363 DeleteParams =
false;
1370 delete QualAttrFactory;
1371 delete MethodQualifiers;
1372 switch (getExceptionSpecType()) {
1376 delete[] Exceptions;
1379 delete ExceptionSpecTokens;
1382 if (NumExceptionsOrDecls != 0)
1383 delete[] DeclsInPrototype;
1389 if (!MethodQualifiers) {
1391 MethodQualifiers =
new DeclSpec(*QualAttrFactory);
1393 return *MethodQualifiers;
1422 return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd());
1432 assert(MethodQualifiers);
1438 assert(MethodQualifiers);
1444 assert(MethodQualifiers);
1474 assert(ExceptionSpecType !=
EST_None);
1475 return NumExceptionsOrDecls;
1481 assert(ExceptionSpecType ==
EST_None);
1482 return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1512 return *
reinterpret_cast<const CXXScopeSpec *
>(ScopeMem);
1515 Scope().~CXXScopeSpec();
1586 bool isStatic,
bool isStar,
Expr *NumElts,
1607 bool RefQualifierIsLvalueRef,
1614 unsigned NumExceptions,
1616 CachedTokens *ExceptionSpecTokens,
1623 DeclSpec *MethodQualifiers =
nullptr);
1629 I.
Kind = BlockPointer;
1649 I.
Kind = MemberPointer;
1668 return Kind ==
Paren;
1687 unsigned NumBindings : 31;
1688 unsigned DeleteBindings : 1;
1694 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1708 DeleteBindings =
false;
1712 return llvm::makeArrayRef(Bindings, NumBindings);
1796 unsigned InvalidType : 1;
1799 unsigned GroupingParens : 1;
1805 unsigned FunctionDefinition : 2;
1808 unsigned Redeclaration : 1;
1811 unsigned Extension : 1;
1814 unsigned ObjCIvar : 1;
1817 unsigned ObjCWeakProperty : 1;
1820 unsigned InlineStorageUsed : 1;
1853 InvalidType(DS.getTypeSpecType() ==
DeclSpec::TST_error),
1856 ObjCWeakProperty(
false), InlineStorageUsed(
false),
1857 Attrs(ds.getAttributePool().getFactory()), AsmLabel(nullptr) {}
1886 return BindingGroup;
1931 BindingGroup.
clear();
1933 for (
unsigned i = 0, e = DeclTypeInfo.size();
i != e; ++
i)
1934 DeclTypeInfo[
i].destroy();
1935 DeclTypeInfo.clear();
1938 InlineStorageUsed =
false;
1940 ObjCWeakProperty =
false;
1980 llvm_unreachable(
"unknown context kind!");
2018 llvm_unreachable(
"unknown context kind!");
2060 llvm_unreachable(
"unknown context kind!");
2066 if (hasGroupingParens())
return false;
2115 llvm_unreachable(
"unknown context kind!");
2129 Name.
Identifier || isDecompositionDeclarator();
2134 return BindingGroup.
isSet();
2162 DeclTypeInfo.push_back(TI);
2163 DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2164 getAttributePool().takeAllFrom(attrs.getPool());
2167 SetRangeEnd(EndLoc);
2173 DeclTypeInfo.push_back(TI);
2176 SetRangeEnd(EndLoc);
2181 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2190 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2191 return DeclTypeInfo[
i];
2194 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2195 return DeclTypeInfo[
i];
2203 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2207 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2208 DeclTypeInfo.front().destroy();
2209 DeclTypeInfo.erase(DeclTypeInfo.begin());
2216 for (
unsigned i = 0, i_end = DeclTypeInfo.size();
i < i_end; ++
i) {
2217 if (!DeclTypeInfo[
i].isParen())
2218 return &DeclTypeInfo[
i];
2227 for (
unsigned i = DeclTypeInfo.size(), i_end = 0;
i != i_end; --
i) {
2228 if (!DeclTypeInfo[
i-1].isParen())
2229 return &DeclTypeInfo[
i-1];
2248 for (
unsigned i = 0, i_end = DeclTypeInfo.size();
i < i_end; ++
i) {
2249 switch (DeclTypeInfo[
i].Kind) {
2263 llvm_unreachable(
"Invalid type chunk");
2273 return isFunctionDeclarator(index);
2279 assert(isFunctionDeclarator() &&
"Not a function declarator!");
2281 isFunctionDeclarator(index);
2282 return DeclTypeInfo[index].Fun;
2288 return const_cast<Declarator*
>(
this)->getFunctionTypeInfo();
2297 bool isDeclarationOfFunction()
const;
2336 llvm_unreachable(
"unknown context kind!");
2377 llvm_unreachable(
"unknown context kind!");
2383 if (!isFunctionDeclarationContext())
2386 for (
unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2396 for (
const auto &Chunk : type_objects())
2398 Chunk.Fun.hasTrailingReturnType())
2416 SetRangeEnd(lastLoc);
2424 if (!getAttributes().empty() || getDeclSpec().hasAttributes())
2426 for (
unsigned i = 0, e = getNumTypeObjects();
i != e; ++
i)
2427 if (!getTypeObject(
i).getAttrs().empty())
2436 if (AL.isCXX11Attribute())
2437 Ranges.push_back(AL.getRange());
2469 FunctionDefinition = Val;
2483 !getDeclSpec().isFriendSpecified();
2489 bool isStaticMember();
2492 bool isCtorOrDtor();
2505 BitfieldSize(nullptr) {}
2523 const char *&PrevSpec);
2536 static const char *getSpecifierName(
Specifier VS);
2543 unsigned Specifiers;
2576 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2577 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType),
2578 ExplicitRange(ExplicitRange) {}
2598 Captures.push_back(
LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2599 InitCaptureType, ExplicitRange));
2605 #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...
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.
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. ...
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
const IdentifierInfo * getSetterName() const
enum clang::DeclaratorChunk::@217 Kind
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
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
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>::".
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.
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)
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...
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 '::'.
bool isSpecified() const
Return true if the ExplicitSpecifier isn't defaulted.
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.
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?