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");
520 assert(isDeclRep((TST) TypeSpecType) || TypeSpecType == TST_typename);
528 return (TypeSpecType == TST_auto || TypeSpecType == TST_auto_type ||
529 TypeSpecType == TST_decltype_auto);
532 bool hasTagDefinition()
const;
568 return FS_inline_specified | FS_forceinline_specified;
571 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
584 FS_inline_specified =
false;
586 FS_forceinline_specified =
false;
588 FS_virtual_specified =
false;
590 FS_explicit_specified =
false;
592 FS_noreturn_specified =
false;
599 void forEachCVRUQualifier(
605 void forEachQualifier(
618 unsigned getParsedSpecifiers()
const;
640 const char *&PrevSpec,
unsigned &DiagID,
643 const char *&PrevSpec,
unsigned &DiagID);
644 bool SetTypeSpecWidth(TSW W,
SourceLocation Loc,
const char *&PrevSpec,
646 bool SetTypeSpecComplex(TSC C,
SourceLocation Loc,
const char *&PrevSpec,
648 bool SetTypeSpecSign(TSS S,
SourceLocation Loc,
const char *&PrevSpec,
650 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
652 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
655 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
656 unsigned &DiagID,
Decl *Rep,
bool Owned,
664 unsigned &DiagID,
Decl *Rep,
bool Owned,
667 bool SetTypeSpecType(TST T,
SourceLocation Loc,
const char *&PrevSpec,
668 unsigned &DiagID,
Expr *Rep,
670 bool SetTypeAltiVecVector(
bool isAltiVecVector,
SourceLocation Loc,
671 const char *&PrevSpec,
unsigned &DiagID,
674 const char *&PrevSpec,
unsigned &DiagID,
677 const char *&PrevSpec,
unsigned &DiagID,
680 const char *&PrevSpec,
unsigned &DiagID,
684 bool SetTypeSpecError();
686 assert(isDeclRep((TST) TypeSpecType));
690 assert(isTypeRep((TST) TypeSpecType));
694 assert(isExprRep((TST) TypeSpecType));
703 bool setFunctionSpecInline(
SourceLocation Loc,
const char *&PrevSpec,
705 bool setFunctionSpecForceInline(
SourceLocation Loc,
const char *&PrevSpec,
707 bool setFunctionSpecVirtual(
SourceLocation Loc,
const char *&PrevSpec,
709 bool setFunctionSpecExplicit(
SourceLocation Loc,
const char *&PrevSpec,
711 bool setFunctionSpecNoreturn(
SourceLocation Loc,
const char *&PrevSpec,
716 bool setModulePrivateSpec(
SourceLocation Loc,
const char *&PrevSpec,
731 Constexpr_specified =
false;
784 bool isMissingDeclaratorOk();
805 DQ_CSNullability = 0x40
812 DQ_PR_readonly = 0x01,
815 DQ_PR_readwrite = 0x08,
818 DQ_PR_nonatomic = 0x40,
820 DQ_PR_atomic = 0x100,
822 DQ_PR_strong = 0x400,
823 DQ_PR_unsafe_unretained = 0x800,
824 DQ_PR_nullability = 0x1000,
825 DQ_PR_null_resettable = 0x2000,
830 : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
831 Nullability(0), GetterName(nullptr), SetterName(nullptr) { }
852 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
853 (getPropertyAttributes() & DQ_PR_nullability)) &&
854 "Objective-C declspec doesn't have nullability");
859 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
860 (getPropertyAttributes() & DQ_PR_nullability)) &&
861 "Objective-C declspec doesn't have nullability");
862 return NullabilityLoc;
866 assert(((getObjCDeclQualifier() & DQ_CSNullability) ||
867 (getPropertyAttributes() & DQ_PR_nullability)) &&
868 "Set the nullability declspec or property attribute first");
870 NullabilityLoc = loc;
893 unsigned objcDeclQualifier : 7;
896 unsigned PropertyAttributes : 15;
954 unsigned SymbolLocations[3];
966 struct OFI OperatorFunctionId;
1026 StartLocation = EndLocation = IdLoc;
1054 StartLocation = OperatorLoc;
1055 EndLocation = EndLoc;
1056 ConversionFunctionId = Ty;
1071 StartLocation = OpLoc;
1072 EndLocation = IdLoc;
1086 StartLocation = ClassNameLoc;
1087 EndLocation = EndLoc;
1088 ConstructorName = ClassType;
1109 StartLocation = TildeLoc;
1110 EndLocation = EndLoc;
1111 DestructorName = ClassType;
1130 StartLocation = EndLocation = TemplateLoc;
1239 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1240 : Ident(ident), IdentLoc(iloc), Param(param),
1241 DefaultArgTokens(
std::move(DefArgTokens)) {}
1349 for (
unsigned I = 0; I < NumParams; ++I)
1350 Params[I].DefaultArgTokens.reset();
1353 DeleteParams =
false;
1360 delete QualAttrFactory;
1361 delete MethodQualifiers;
1362 switch (getExceptionSpecType()) {
1366 delete[] Exceptions;
1369 delete ExceptionSpecTokens;
1372 if (NumExceptionsOrDecls != 0)
1373 delete[] DeclsInPrototype;
1379 if (!MethodQualifiers) {
1381 MethodQualifiers =
new DeclSpec(*QualAttrFactory);
1383 return *MethodQualifiers;
1412 return SourceRange(getExceptionSpecLocBeg(), getExceptionSpecLocEnd());
1422 assert(MethodQualifiers);
1428 assert(MethodQualifiers);
1434 assert(MethodQualifiers);
1464 assert(ExceptionSpecType !=
EST_None);
1465 return NumExceptionsOrDecls;
1471 assert(ExceptionSpecType ==
EST_None);
1472 return llvm::makeArrayRef(DeclsInPrototype, NumExceptionsOrDecls);
1502 return *
reinterpret_cast<const CXXScopeSpec *
>(ScopeMem);
1505 Scope().~CXXScopeSpec();
1576 bool isStatic,
bool isStar,
Expr *NumElts,
1597 bool RefQualifierIsLvalueRef,
1604 unsigned NumExceptions,
1606 CachedTokens *ExceptionSpecTokens,
1613 DeclSpec *MethodQualifiers =
nullptr);
1619 I.
Kind = BlockPointer;
1639 I.
Kind = MemberPointer;
1658 return Kind ==
Paren;
1677 unsigned NumBindings : 31;
1678 unsigned DeleteBindings : 1;
1684 : Bindings(nullptr), NumBindings(0), DeleteBindings(
false) {}
1698 DeleteBindings =
false;
1702 return llvm::makeArrayRef(Bindings, NumBindings);
1786 unsigned InvalidType : 1;
1789 unsigned GroupingParens : 1;
1795 unsigned FunctionDefinition : 2;
1798 unsigned Redeclaration : 1;
1801 unsigned Extension : 1;
1804 unsigned ObjCIvar : 1;
1807 unsigned ObjCWeakProperty : 1;
1810 unsigned InlineStorageUsed : 1;
1843 InvalidType(DS.getTypeSpecType() ==
DeclSpec::TST_error),
1846 ObjCWeakProperty(
false), InlineStorageUsed(
false),
1847 Attrs(ds.getAttributePool().getFactory()), AsmLabel(nullptr) {}
1876 return BindingGroup;
1921 BindingGroup.
clear();
1923 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
1924 DeclTypeInfo[i].destroy();
1925 DeclTypeInfo.clear();
1928 InlineStorageUsed =
false;
1930 ObjCWeakProperty =
false;
1970 llvm_unreachable(
"unknown context kind!");
2008 llvm_unreachable(
"unknown context kind!");
2050 llvm_unreachable(
"unknown context kind!");
2056 if (hasGroupingParens())
return false;
2105 llvm_unreachable(
"unknown context kind!");
2119 Name.
Identifier || isDecompositionDeclarator();
2124 return BindingGroup.
isSet();
2152 DeclTypeInfo.push_back(TI);
2153 DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2154 getAttributePool().takeAllFrom(attrs.getPool());
2157 SetRangeEnd(EndLoc);
2163 DeclTypeInfo.push_back(TI);
2166 SetRangeEnd(EndLoc);
2171 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2180 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2181 return DeclTypeInfo[i];
2184 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2185 return DeclTypeInfo[i];
2193 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2197 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2198 DeclTypeInfo.front().destroy();
2199 DeclTypeInfo.erase(DeclTypeInfo.begin());
2206 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2207 if (!DeclTypeInfo[i].isParen())
2208 return &DeclTypeInfo[i];
2217 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2218 if (!DeclTypeInfo[i-1].isParen())
2219 return &DeclTypeInfo[i-1];
2238 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2239 switch (DeclTypeInfo[i].Kind) {
2253 llvm_unreachable(
"Invalid type chunk");
2263 return isFunctionDeclarator(index);
2269 assert(isFunctionDeclarator() &&
"Not a function declarator!");
2271 isFunctionDeclarator(index);
2272 return DeclTypeInfo[index].Fun;
2278 return const_cast<Declarator*
>(
this)->getFunctionTypeInfo();
2287 bool isDeclarationOfFunction()
const;
2326 llvm_unreachable(
"unknown context kind!");
2367 llvm_unreachable(
"unknown context kind!");
2373 if (!isFunctionDeclarationContext())
2376 for (
unsigned I = 0, N = getNumTypeObjects(); I != N; ++I)
2386 for (
const auto &Chunk : type_objects())
2388 Chunk.Fun.hasTrailingReturnType())
2406 SetRangeEnd(lastLoc);
2414 if (!getAttributes().empty() || getDeclSpec().hasAttributes())
2416 for (
unsigned i = 0, e = getNumTypeObjects(); i != e; ++i)
2417 if (!getTypeObject(i).getAttrs().empty())
2426 if (AL.isCXX11Attribute())
2427 Ranges.push_back(AL.getRange());
2459 FunctionDefinition = Val;
2473 !getDeclSpec().isFriendSpecified();
2479 bool isStaticMember();
2482 bool isCtorOrDtor();
2495 BitfieldSize(nullptr) {}
2513 const char *&PrevSpec);
2526 static const char *getSpecifierName(
Specifier VS);
2533 unsigned Specifiers;
2566 : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc),
2567 InitKind(InitKind), Init(Init), InitCaptureType(InitCaptureType),
2568 ExplicitRange(ExplicitRange) {}
2588 Captures.push_back(
LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init,
2589 InitCaptureType, ExplicitRange));
2595 #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...
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
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
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.
enum clang::DeclaratorChunk::@215 Kind
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.
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.
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>::".
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.
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)
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.
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?