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");
304 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 305 static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t; 306 #include "clang/Basic/OpenCLImageTypes.def" 325 PQ_StorageClassSpecifier = 1,
326 PQ_TypeSpecifier = 2,
327 PQ_TypeQualifier = 4,
328 PQ_FunctionSpecifier = 8
333 unsigned StorageClassSpec : 3;
334 unsigned ThreadStorageClassSpec : 2;
335 unsigned SCS_extern_in_linkage_spec : 1;
338 unsigned TypeSpecWidth : 2;
339 unsigned TypeSpecComplex : 2;
340 unsigned TypeSpecSign : 2;
341 unsigned TypeSpecType : 6;
342 unsigned TypeAltiVecVector : 1;
343 unsigned TypeAltiVecPixel : 1;
344 unsigned TypeAltiVecBool : 1;
345 unsigned TypeSpecOwned : 1;
346 unsigned TypeSpecPipe : 1;
349 unsigned TypeQualifiers : 5;
352 unsigned FS_inline_specified : 1;
353 unsigned FS_forceinline_specified: 1;
354 unsigned FS_virtual_specified : 1;
355 unsigned FS_explicit_specified : 1;
356 unsigned FS_noreturn_specified : 1;
359 unsigned Friend_specified : 1;
362 unsigned Constexpr_specified : 1;
389 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
391 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
397 void SaveWrittenBuiltinSpecs();
401 static bool isTypeRep(TST
T) {
402 return (T == TST_typename || T == TST_typeofType ||
403 T == TST_underlyingType || T == TST_atomic);
405 static bool isExprRep(TST T) {
406 return (T == TST_typeofExpr || T == TST_decltype);
410 void operator=(
const DeclSpec &) =
delete;
413 return (T == TST_enum || T == TST_struct ||
414 T == TST_interface || T == TST_union ||
419 : StorageClassSpec(SCS_unspecified),
420 ThreadStorageClassSpec(TSCS_unspecified),
421 SCS_extern_in_linkage_spec(
false),
422 TypeSpecWidth(TSW_unspecified),
423 TypeSpecComplex(TSC_unspecified),
424 TypeSpecSign(TSS_unspecified),
425 TypeSpecType(TST_unspecified),
426 TypeAltiVecVector(
false),
427 TypeAltiVecPixel(
false),
428 TypeAltiVecBool(
false),
429 TypeSpecOwned(
false),
431 TypeQualifiers(TQ_unspecified),
432 FS_inline_specified(
false),
433 FS_forceinline_specified(
false),
434 FS_virtual_specified(
false),
435 FS_explicit_specified(
false),
436 FS_noreturn_specified(
false),
437 Friend_specified(
false),
438 Constexpr_specified(
false),
441 ObjCQualifiers(nullptr) {
447 return (TSCS)ThreadStorageClassSpec;
451 SCS_extern_in_linkage_spec =
Value;
456 return ThreadStorageClassSpecLoc;
462 SCS_extern_in_linkage_spec =
false;
469 TypeSpecOwned =
false;
486 assert(isTypeRep((TST) TypeSpecType) &&
"DeclSpec does not store a type");
490 assert(isDeclRep((TST) TypeSpecType) &&
"DeclSpec does not store a decl");
494 assert(isExprRep((TST) TypeSpecType) &&
"DeclSpec does not store an expr");
512 assert(isDeclRep((TST) TypeSpecType) || TypeSpecType == TST_typename);
520 return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type ||
521 TypeSpecType == TST_decltype_auto);
524 bool hasTagDefinition()
const;
560 return FS_inline_specified | FS_forceinline_specified;
563 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
576 FS_inline_specified =
false;
578 FS_forceinline_specified =
false;
580 FS_virtual_specified =
false;
582 FS_explicit_specified =
false;
584 FS_noreturn_specified =
false;
598 unsigned getParsedSpecifiers()
const;
620 const char *&PrevSpec,
unsigned &DiagID,
623 const char *&PrevSpec,
unsigned &DiagID);
624 bool SetTypeSpecWidth(TSW W,
SourceLocation Loc,
const char *&PrevSpec,
626 bool SetTypeSpecComplex(TSC C,
SourceLocation Loc,
const char *&PrevSpec,
628 bool SetTypeSpecSign(TSS S,
SourceLocation Loc,
const char *&PrevSpec,
630 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
632 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
635 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
636 unsigned &DiagID,
Decl *Rep,
bool Owned,
644 unsigned &DiagID,
Decl *Rep,
bool Owned,
647 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
648 unsigned &DiagID,
Expr *Rep,
650 bool SetTypeAltiVecVector(
bool isAltiVecVector,
SourceLocation Loc,
651 const char *&PrevSpec,
unsigned &DiagID,
654 const char *&PrevSpec,
unsigned &DiagID,
657 const char *&PrevSpec,
unsigned &DiagID,
660 const char *&PrevSpec,
unsigned &DiagID,
662 bool SetTypeSpecError();
664 assert(isDeclRep((TST) TypeSpecType));
668 assert(isTypeRep((TST) TypeSpecType));
672 assert(isExprRep((TST) TypeSpecType));
679 bool setFunctionSpecInline(
SourceLocation Loc,
const char *&PrevSpec,
681 bool setFunctionSpecForceInline(
SourceLocation Loc,
const char *&PrevSpec,
683 bool setFunctionSpecVirtual(
SourceLocation Loc,
const char *&PrevSpec,
685 bool setFunctionSpecExplicit(
SourceLocation Loc,
const char *&PrevSpec,
687 bool setFunctionSpecNoreturn(
SourceLocation Loc,
const char *&PrevSpec,
692 bool setModulePrivateSpec(
SourceLocation Loc,
const char *&PrevSpec,
707 Constexpr_specified =
false;
760 bool isMissingDeclaratorOk();
781 DQ_CSNullability = 0x40
788 DQ_PR_readonly = 0x01,
791 DQ_PR_readwrite = 0x08,
794 DQ_PR_nonatomic = 0x40,
796 DQ_PR_atomic = 0x100,
798 DQ_PR_strong = 0x400,
799 DQ_PR_unsafe_unretained = 0x800,
800 DQ_PR_nullability = 0x1000,
801 DQ_PR_null_resettable = 0x2000,
806 : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
807 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
828 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
829 (getPropertyAttributes() & DQ_PR_nullability)) &&
830 "Objective-C declspec doesn't have nullability");
835 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
836 (getPropertyAttributes() & DQ_PR_nullability)) &&
837 "Objective-C declspec doesn't have nullability");
838 return NullabilityLoc;
842 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
843 (getPropertyAttributes() & DQ_PR_nullability)) &&
844 "Set the nullability declspec or property attribute first");
846 NullabilityLoc = loc;
869 unsigned objcDeclQualifier : 7;
872 unsigned PropertyAttributes : 15;
930 unsigned SymbolLocations[3];
942 struct OFI OperatorFunctionId;
980 Identifier =
nullptr;
1002 StartLocation = EndLocation = IdLoc;
1030 StartLocation = OperatorLoc;
1031 EndLocation = EndLoc;
1032 ConversionFunctionId = Ty;
1047 StartLocation = OpLoc;
1048 EndLocation = IdLoc;
1062 StartLocation = ClassNameLoc;
1063 EndLocation = EndLoc;
1064 ConstructorName = ClassType;
1085 StartLocation = TildeLoc;
1086 EndLocation = EndLoc;
1087 DestructorName = ClassType;
1106 StartLocation = EndLocation = TemplateLoc;
1217 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1218 : Ident(ident), IdentLoc(iloc), Param(param),
1219 DefaultArgTokens(
std::move(DefArgTokens)) {}
1340 for (
unsigned I = 0; I < NumParams; ++I)
1341 Params[I].DefaultArgTokens.reset();
1344 DeleteParams =
false;
1352 switch (getExceptionSpecType()) {
1356 delete[] Exceptions;
1359 delete ExceptionSpecTokens;
1362 if (NumExceptionsOrDecls != 0)
1363 delete[] DeclsInPrototype;
1394 return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd());
1437 assert(ExceptionSpecType !=
EST_None);
1438 return NumExceptionsOrDecls;
1444 assert(ExceptionSpecType ==
EST_None);
1445 return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1475 return *
reinterpret_cast<const CXXScopeSpec *
>(ScopeMem);
1478 Scope().~CXXScopeSpec();
1516 return Common.AttrList;
1520 return Common.AttrList;
1557 bool isStatic,
bool isStar,
Expr *NumElts,
1580 bool RefQualifierIsLvalueRef,
1590 unsigned NumExceptions,
1592 CachedTokens *ExceptionSpecTokens,
1604 I.
Kind = BlockPointer;
1626 I.
Kind = MemberPointer;
1647 return Kind ==
Paren;
1666 unsigned NumBindings : 31;
1667 unsigned DeleteBindings : 1;
1673 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1687 DeleteBindings =
false;
1691 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;
1908 BindingGroup.
clear();
1910 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1911 DeclTypeInfo[i].destroy();
1912 DeclTypeInfo.clear();
1915 InlineStorageUsed =
false;
1917 ObjCWeakProperty =
false;
1955 llvm_unreachable(
"unknown context kind!");
1991 llvm_unreachable(
"unknown context kind!");
2031 llvm_unreachable(
"unknown context kind!");
2037 if (hasGroupingParens())
return false;
2084 llvm_unreachable(
"unknown context kind!");
2098 Name.
Identifier || isDecompositionDeclarator();
2103 return BindingGroup.
isSet();
2130 DeclTypeInfo.push_back(TI);
2131 DeclTypeInfo.back().getAttrListRef() = attrs.
getList();
2132 getAttributePool().takeAllFrom(attrs.
getPool());
2135 SetRangeEnd(EndLoc);
2140 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2149 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2150 return DeclTypeInfo[i];
2153 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2154 return DeclTypeInfo[i];
2162 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2166 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2167 DeclTypeInfo.front().destroy();
2168 DeclTypeInfo.erase(DeclTypeInfo.begin());
2175 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2176 if (!DeclTypeInfo[i].isParen())
2177 return &DeclTypeInfo[i];
2186 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2187 if (!DeclTypeInfo[i-1].isParen())
2188 return &DeclTypeInfo[i-1];
2207 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2208 switch (DeclTypeInfo[i].Kind) {
2222 llvm_unreachable(
"Invalid type chunk");
2232 return isFunctionDeclarator(index);
2238 assert(isFunctionDeclarator() &&
"Not a function declarator!");
2240 isFunctionDeclarator(index);
2241 return DeclTypeInfo[index].Fun;
2247 return const_cast<Declarator*
>(
this)->getFunctionTypeInfo();
2256 bool isDeclarationOfFunction()
const;
2293 llvm_unreachable(
"unknown context kind!");
2332 llvm_unreachable(
"unknown context kind!");
2338 if (!isFunctionDeclarationContext())
2341 for (
unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2351 for (
const auto &Chunk : type_objects())
2353 Chunk.Fun.hasTrailingReturnType())
2371 SetRangeEnd(lastLoc);
2381 if (getAttributes() || getDeclSpec().hasAttributes())
return true;
2382 for (
unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
2383 if (getTypeObject(i).getAttrs())
2394 Ranges.push_back(AttrList->
getRange());
2395 AttrList = AttrList->
getNext();
2428 FunctionDefinition = Val;
2442 !getDeclSpec().isFriendSpecified();
2448 bool isStaticMember();
2451 bool isCtorOrDtor();
2464 BitfieldSize(nullptr) {}
2482 const char *&PrevSpec);
2495 static const char *getSpecifierName(
Specifier VS);
2502 unsigned Specifiers;
2532 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2533 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType) {}
2552 Captures.push_back(
LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2559 #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.
AttributeList * getNext() const
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.
One instance of this struct is used for each type in a declarator that is parsed. ...
NamespaceDecl - Represent a C++ namespace.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
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...
LambdaCaptureInitKind InitKind
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
AttributeList *& getAttrListRef()
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
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
AttributeList * getList() const
void addAll(AttributeList *newList)
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.
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.
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
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.
void addAttributes(AttributeList *AL)
Concatenates two attribute lists.
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.
enum clang::DeclaratorChunk::@198 Kind
TSS getTypeSpecSign() const
bool hasAttributes() const
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
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.
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType)
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
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear...
IdentifierInfo * getSetterName()
void SetRangeStart(SourceLocation Loc)
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
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
AttributeList * getAttributes()
TST getTypeSpecType() const
static bool isDeclRep(TST T)
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.
const FunctionProtoType * T
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
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
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 isCXX11Attribute() const
SourceRange getRange() 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.
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.
const AttributeList * getAttributes() const
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.
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType)
Append a capture in a lambda introducer.
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
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
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>::".
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.
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
AttributeList *& getAttrListRef()
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)
const AttributeList * getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
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)
bool isTypeAltiVecBool() const
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.
ActionResult< ParsedType > TypeResult
unsigned AtomicQualLoc
The location of the _Atomic-qualifier, if any.
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
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.
NamedDecl - This represents a decl with 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
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)
AttributeList *& getListRef()
Returns a reference to the attribute list.
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedAttributes & getAttributes()
SourceRange getTypeofParensRange() const
AttributeList - Represents a syntactic attribute.
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation Loc)
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?