22#ifndef LLVM_CLANG_SEMA_DECLSPEC_H
23#define LLVM_CLANG_SEMA_DECLSPEC_H
35#include "llvm/ADT/STLExtras.h"
36#include "llvm/ADT/SmallVector.h"
37#include "llvm/Support/Compiler.h"
38#include "llvm/Support/ErrorHandling.h"
52class OverflowBehaviorType;
91 TemplateParamLists = L;
94 return TemplateParamLists;
99 return Builder.getRepresentation();
193 assert(R.isValid() &&
"Must have a valid source range");
194 if (Range.getBegin().isInvalid())
195 Range.setBegin(R.getBegin());
196 Range.setEnd(R.getEnd());
224 bool LateAttrParseExperimentalExtOnly =
false,
225 bool LateAttrParseTypeAttrOnly =
false)
227 LateAttrParseExperimentalExtOnly(LateAttrParseExperimentalExtOnly),
228 LateAttrParseTypeAttrOnly(LateAttrParseTypeAttrOnly) {}
242 return LateAttrParseExperimentalExtOnly;
249 bool LateAttrParseExperimentalExtOnly;
250 bool LateAttrParseTypeAttrOnly;
352#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
353 static const TST TST_##Trait = clang::TST_##Trait;
354#include "clang/Basic/BuiltinTraits.inc"
359#define GENERIC_IMAGE_TYPE(ImgType, Id) \
360 static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t;
361#include "clang/Basic/OpenCLImageTypes.def"
362#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
363 static const TST TST_##Name = clang::TST_##Name;
364#include "clang/Basic/HLSLIntangibleTypes.def"
365#define HLSL_PACKED_TYPE(Name, Id, SingletonId) \
366 static const TST TST_##Name = clang::TST_##Name;
367#include "clang/Basic/HLSLPackedTypes.def"
403 LLVM_PREFERRED_TYPE(
SCS)
404 unsigned StorageClassSpec : 3;
405 LLVM_PREFERRED_TYPE(
TSCS)
406 unsigned ThreadStorageClassSpec : 2;
407 LLVM_PREFERRED_TYPE(
bool)
408 unsigned SCS_extern_in_linkage_spec : 1;
412 unsigned TypeSpecWidth : 2;
413 LLVM_PREFERRED_TYPE(
TSC)
414 unsigned TypeSpecComplex : 2;
416 unsigned TypeSpecSign : 2;
417 LLVM_PREFERRED_TYPE(
TST)
418 unsigned TypeSpecType : 7;
419 LLVM_PREFERRED_TYPE(
bool)
420 unsigned TypeAltiVecVector : 1;
421 LLVM_PREFERRED_TYPE(
bool)
422 unsigned TypeAltiVecPixel : 1;
423 LLVM_PREFERRED_TYPE(
bool)
424 unsigned TypeAltiVecBool : 1;
425 LLVM_PREFERRED_TYPE(
bool)
426 unsigned TypeSpecOwned : 1;
427 LLVM_PREFERRED_TYPE(
bool)
428 unsigned TypeSpecPipe : 1;
429 LLVM_PREFERRED_TYPE(
bool)
430 unsigned TypeSpecSat : 1;
431 LLVM_PREFERRED_TYPE(
bool)
432 unsigned ConstrainedAuto : 1;
435 LLVM_PREFERRED_TYPE(
TQ)
436 unsigned TypeQualifiers : 5;
440 unsigned OB_state : 2;
443 LLVM_PREFERRED_TYPE(
bool)
444 unsigned FS_inline_specified : 1;
445 LLVM_PREFERRED_TYPE(
bool)
446 unsigned FS_forceinline_specified: 1;
447 LLVM_PREFERRED_TYPE(
bool)
448 unsigned FS_virtual_specified : 1;
449 LLVM_PREFERRED_TYPE(
bool)
450 unsigned FS_noreturn_specified : 1;
453 LLVM_PREFERRED_TYPE(
bool)
454 unsigned FriendSpecifiedFirst : 1;
458 unsigned ConstexprSpecifier : 2;
486 SourceLocation TSCLoc, TSSLoc, TSTLoc, AltiVecLoc, TSSatLoc, EllipsisLoc;
493 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
496 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
503 void SaveWrittenBuiltinSpecs();
512 static bool isExprRep(
TST T) {
516 static bool isTemplateIdRep(
TST T) {
520 DeclSpec(
const DeclSpec &) =
delete;
521 void operator=(
const DeclSpec &) =
delete;
529 constexpr std::array<TST, 16> Traits = {
530#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) TST_##Trait,
531#include "clang/Basic/BuiltinTraits.inc"
534 return T >= Traits.front() && T <= Traits.back();
540 SCS_extern_in_linkage_spec(
false),
549 FS_inline_specified(
false), FS_forceinline_specified(
false),
550 FS_virtual_specified(
false), FS_noreturn_specified(
false),
551 FriendSpecifiedFirst(
false), ConstexprSpecifier(static_cast<
unsigned>(
553 Attrs(attrFactory), writtenBS(), ObjCQualifiers(
nullptr) {}
558 return (
TSCS)ThreadStorageClassSpec;
562 SCS_extern_in_linkage_spec =
Value;
567 return ThreadStorageClassSpecLoc;
573 SCS_extern_in_linkage_spec =
false;
580 TypeSpecOwned =
false;
603 assert(
isTypeRep((
TST) TypeSpecType) &&
"DeclSpec does not store a type");
607 assert(
isDeclRep((
TST) TypeSpecType) &&
"DeclSpec does not store a decl");
611 assert(isExprRep((
TST) TypeSpecType) &&
"DeclSpec does not store an expr");
617 "DeclSpec is not a pack indexing expr");
618 return PackIndexingExpr;
622 assert(isTemplateIdRep((
TST) TypeSpecType) &&
623 "DeclSpec does not store a template id");
643 isExprRep((
TST)TypeSpecType));
715 return FS_inline_specified | FS_forceinline_specified;
718 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
722 return FS_explicit_specifier;
729 return FS_explicit_specifier.isSpecified();
733 return FS_explicit_specifier.getExpr()
734 ?
SourceRange(FS_explicitLoc, FS_explicitCloseParenLoc)
742 FS_inline_specified =
false;
744 FS_forceinline_specified =
false;
746 FS_virtual_specified =
false;
751 FS_noreturn_specified =
false;
799 const char *&PrevSpec,
unsigned &DiagID,
802 const char *&PrevSpec,
unsigned &DiagID);
804 const char *&PrevSpec,
unsigned &DiagID,
809 const char *&PrevSpec,
unsigned &DiagID);
823 unsigned &DiagID,
Decl *Rep,
bool Owned,
831 unsigned &DiagID,
Decl *Rep,
bool Owned,
838 unsigned &DiagID,
Expr *Rep,
841 const char *&PrevSpec,
unsigned &DiagID,
844 const char *&PrevSpec,
unsigned &DiagID,
847 const char *&PrevSpec,
unsigned &DiagID,
850 const char *&PrevSpec,
unsigned &DiagID,
853 const char *&PrevSpec,
unsigned &DiagID,
870 assert(isExprRep((
TST) TypeSpecType));
896 const char *&PrevSpec,
unsigned &DiagID);
924 return Attrs.getPool();
945 Attrs.prepend(AL.
begin(), AL.
end());
955 return LateParsedAttrs;
959 Attrs.takeAllAppendingFrom(attrs);
1024 PropertyAttributes =
1032 "Objective-C declspec doesn't have nullability");
1040 "Objective-C declspec doesn't have nullability");
1041 return NullabilityLoc;
1048 "Set the nullability declspec or property attribute first");
1049 Nullability =
static_cast<unsigned>(
kind);
1050 NullabilityLoc = loc;
1058 GetterNameLoc = loc;
1066 SetterNameLoc = loc;
1073 unsigned objcDeclQualifier : 7;
1078 unsigned Nullability : 2;
1114class UnqualifiedId {
1117 const UnqualifiedId &operator=(
const UnqualifiedId &) =
delete;
1380 LLVM_PREFERRED_TYPE(
bool)
1403 LLVM_PREFERRED_TYPE(
bool)
1407 LLVM_PREFERRED_TYPE(
bool)
1439 std::unique_ptr<CachedTokens> DefArgTokens =
nullptr)
1453 LLVM_PREFERRED_TYPE(
bool)
1459 LLVM_PREFERRED_TYPE(
bool)
1463 LLVM_PREFERRED_TYPE(
bool)
1468 LLVM_PREFERRED_TYPE(
bool)
1476 LLVM_PREFERRED_TYPE(
bool)
1481 LLVM_PREFERRED_TYPE(
bool)
1560 for (
unsigned I = 0; I <
NumParams; ++I)
1561 Params[I].DefaultArgTokens.reset();
1719 Scope().~CXXScopeSpec();
1766 bool OverflowBehaviorIsWrap =
false) {
1770 new (&I.
Ptr) PointerTypeInfo;
1795 bool isStatic,
bool isStar,
Expr *NumElts,
1813 ParamInfo *Params,
unsigned NumParams,
1816 bool RefQualifierIsLvalueRef,
1823 unsigned NumExceptions,
1834 DeclSpec *MethodQualifiers =
nullptr);
1903 unsigned NumBindings : 31;
1904 LLVM_PREFERRED_TYPE(
bool)
1905 unsigned DeleteBindings : 1;
1911 : Bindings(
nullptr), NumBindings(0), DeleteBindings(
false) {}
1925 DeleteBindings =
false;
1932 bool isSet()
const {
return LSquareLoc.isValid(); }
2021 LLVM_PREFERRED_TYPE(
bool)
2022 unsigned InvalidType : 1;
2025 LLVM_PREFERRED_TYPE(
bool)
2026 unsigned GroupingParens : 1;
2033 unsigned FunctionDefinition : 2;
2036 LLVM_PREFERRED_TYPE(
bool)
2037 unsigned Redeclaration : 1;
2040 LLVM_PREFERRED_TYPE(
bool)
2041 unsigned Extension : 1;
2044 LLVM_PREFERRED_TYPE(
bool)
2045 unsigned ObjCIvar : 1;
2048 LLVM_PREFERRED_TYPE(
bool)
2049 unsigned ObjCWeakProperty : 1;
2052 LLVM_PREFERRED_TYPE(
bool)
2053 unsigned InlineStorageUsed : 1;
2056 LLVM_PREFERRED_TYPE(
bool)
2057 unsigned HasInitializer : 1;
2078 Expr *TrailingRequiresClause;
2133 GroupingParens(
false), FunctionDefinition(static_cast<
unsigned>(
2136 ObjCWeakProperty(
false), InlineStorageUsed(
false),
2138 DeclarationAttrs(DeclarationAttrs), AsmLabel(
nullptr),
2139 TrailingRequiresClause(
nullptr),
2140 InventedTemplateParameterList(
nullptr) {
2141 assert(llvm::all_of(DeclarationAttrs,
2146 "DeclarationAttrs may only contain [[]] and keyword attributes");
2164 return Attrs.getPool();
2176 return BindingGroup;
2198 Range.setBegin(Loc);
2210 if (Range.getBegin().isInvalid())
2213 Range.setEnd(SR.
getEnd());
2220 Range = DS.getSourceRange();
2221 BindingGroup.clear();
2223 for (
unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
2224 DeclTypeInfo[i].destroy();
2225 DeclTypeInfo.clear();
2227 LateParsedAttrs.clear();
2228 DeclarationLateAttrs =
nullptr;
2230 InlineStorageUsed =
false;
2231 HasInitializer =
false;
2233 ObjCWeakProperty =
false;
2236 PackIndexingExpr =
nullptr;
2276 llvm_unreachable(
"unknown context kind!");
2316 llvm_unreachable(
"unknown context kind!");
2360 llvm_unreachable(
"unknown context kind!");
2417 llvm_unreachable(
"unknown context kind!");
2436 return BindingGroup.isSet();
2441 return Name.Identifier;
2449 Name.setIdentifier(Id, IdLoc);
2465 DeclTypeInfo.push_back(TI);
2466 DeclTypeInfo.back().getAttrs().prepend(attrs.begin(), attrs.end());
2472 DeclTypeInfo.back().LateAttrList.append(LateAttrs);
2481 DeclTypeInfo.push_back(TI);
2491 DeclTypeInfo.push_back(TI);
2494 "Cannot add a declarator chunk with attributes with this overload");
2502 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2511 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2512 return DeclTypeInfo[i];
2515 assert(i < DeclTypeInfo.size() &&
"Invalid type chunk");
2516 return DeclTypeInfo[i];
2528 assert(!DeclTypeInfo.empty() &&
"No type chunks to drop.");
2529 DeclTypeInfo.front().destroy();
2530 DeclTypeInfo.erase(DeclTypeInfo.begin());
2537 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2538 if (!DeclTypeInfo[i].isParen())
2539 return &DeclTypeInfo[i];
2548 for (
unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2549 if (!DeclTypeInfo[i-1].isParen())
2550 return &DeclTypeInfo[i-1];
2569 for (
unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2570 switch (DeclTypeInfo[i].Kind) {
2584 llvm_unreachable(
"Invalid type chunk");
2603 return DeclTypeInfo[
index].Fun;
2659 llvm_unreachable(
"unknown context kind!");
2702 llvm_unreachable(
"unknown context kind!");
2723 Chunk.Fun.hasTrailingReturnType())
2732 Chunk.Fun.hasTrailingReturnType())
2733 return Chunk.Fun.getTrailingReturnType();
2739 TrailingRequiresClause = TRC;
2746 return TrailingRequiresClause;
2752 return TrailingRequiresClause !=
nullptr;
2757 TemplateParameterLists = TPLs;
2762 return TemplateParameterLists;
2769 InventedTemplateParameterList = Invented;
2776 return InventedTemplateParameterList;
2789 Attrs.takeAllAppendingFrom(attrs);
2799 return DeclarationAttrs;
2804 return LateParsedAttrs;
2808 return DeclarationLateAttrs;
2811 DeclarationLateAttrs = L;
2858 FunctionDefinition =
static_cast<unsigned>(Val);
2919 const char *&PrevSpec);
2940 unsigned Specifiers = 0;
2941 Specifier LastSpecifier =
VS_None;
2999 InitCaptureType, ExplicitRange));
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
Defines an enumeration for C++ overloaded operators.
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
Defines various enumerations that describe declaration and type specifiers.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isRegularKeywordAttribute() const
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
void takeFrom(ParsedAttributesView &List, AttributePool &Pool)
Removes the attributes from List, which are owned by Pool, and adds them at the end of this Attribute...
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
[BoundsSafety] Represents a parent type class for CountAttributedType and similar sugar types that wi...
Represents a C++ struct/union/class.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
char * location_data() const
Retrieve the data associated with the source-location information.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getEndLoc() const
void setRange(SourceRange R)
void setBeginLoc(SourceLocation Loc)
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
SourceLocation getBeginLoc() const
bool isSet() const
Deprecated.
ArrayRef< TemplateParameterList * > getTemplateParamLists() const
NestedNameSpecifier getScopeRep() const
Retrieve the representation of the nested-name-specifier.
void setEndLoc(SourceLocation Loc)
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void setTemplateParamLists(ArrayRef< TemplateParameterList * > L)
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Captures information about "declaration specifiers".
bool isVirtualSpecified() const
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
bool isTypeSpecPipe() const
bool isModulePrivateSpecified() const
static const TSCS TSCS___thread
void UpdateDeclRep(Decl *Rep)
static const TST TST_typeof_unqualType
SourceLocation getTypeSpecSignLoc() const
void setTypeArgumentRange(SourceRange range)
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
SourceLocation getPipeLoc() const
bool hasAutoTypeSpec() const
static const TST TST_typename
SourceLocation getEndLoc() const LLVM_READONLY
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
const ParsedAttributes & getAttributes() const
ThreadStorageClassSpecifier TSCS
void setObjCQualifiers(ObjCDeclSpec *quals)
static const TST TST_char8
static const TST TST_BFloat16
Expr * getPackIndexingExpr() const
void ClearStorageClassSpecs()
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TSCS TSCS__Thread_local
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
bool isNoreturnSpecified() const
LateParsedTypeAttrInfoList & getLateAttributes()
TST getTypeSpecType() const
SourceLocation getStorageClassSpecLoc() const
SCS getStorageClassSpec() const
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceLocation getOverflowBehaviorLoc() const
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
SourceLocation getBeginLoc() const LLVM_READONLY
bool isTypeSpecSat() const
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceRange getSourceRange() const LLVM_READONLY
void SetPackIndexingExpr(SourceLocation EllipsisLoc, Expr *Pack)
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void SetRangeEnd(SourceLocation Loc)
ObjCDeclSpec * getObjCQualifiers() const
bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_auto_type
static const TST TST_interface
static const TST TST_double
static const TST TST_typeofExpr
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
void SetRangeStart(SourceLocation Loc)
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceLocation getNoreturnSpecLoc() const
TemplateIdAnnotation * getRepAsTemplateId() const
bool isExternInLinkageSpec() const
const CXXScopeSpec & getTypeSpecScope() const
static const TST TST_union
static const TST TST_typename_pack_indexing
void CheckFriendSpec(Sema &S, const PrintingPolicy &Policy)
static const TST TST_char
static const TST TST_bool
static const TST TST_char16
SCS
storage-class-specifier
SourceLocation getExplicitSpecLoc() const
static const TST TST_unknown_anytype
SourceLocation getAltiVecLoc() const
SourceLocation getFriendSpecLoc() const
TSC getTypeSpecComplex() const
SourceLocation getModulePrivateSpecLoc() const
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
ParsedType getRepAsType() const
void UpdateTypeRep(ParsedType Rep)
TSCS getThreadStorageClassSpec() const
bool isFriendSpecifiedFirst() const
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool hasAttributes() const
static const TST TST_accum
static const TST TST_half
ParsedAttributes & getAttributes()
SourceLocation getEllipsisLoc() const
bool isTypeAltiVecPixel() const
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
bool SetOverflowBehavior(OverflowBehaviorType::OverflowBehaviorKind Kind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceLocation getConstSpecLoc() const
SourceRange getExplicitSpecRange() const
static const TST TST_ibm128
DeclSpec(AttributeFactory &attrFactory)
Expr * getRepAsExpr() const
void addAttributes(const ParsedAttributesView &AL)
Concatenates two attribute lists.
static const TST TST_enum
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
AttributePool & getAttributePool() const
bool isWrapSpecified() const
static const TST TST_float128
static const TST TST_decltype
SourceRange getTypeSpecWidthRange() const
SourceLocation getTypeSpecTypeNameLoc() const
static bool isDeclRep(TST T)
void takeAttributesAppendingingFrom(ParsedAttributes &attrs)
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Complex" (la...
bool isInlineSpecified() const
SourceLocation getTypeSpecWidthLoc() const
SourceLocation getRestrictSpecLoc() const
static const TST TST_typeof_unqualExpr
static const TST TST_class
bool isOverflowBehaviorSpecified() const
bool hasTagDefinition() const
static const TST TST_decimal64
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
bool isTypeAltiVecBool() const
void ClearFunctionSpecs()
bool isConstrainedAuto() const
bool SetTypeQual(TQ T, SourceLocation Loc)
static const TST TST_wchar
SourceLocation getTypeSpecComplexLoc() const
static const TST TST_void
static const TSCS TSCS_unspecified
bool isTypeAltiVecVector() const
static const TST TST_bitint
void ClearConstexprSpec()
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
static const TST TST_float
static const TST TST_atomic
bool isTrapSpecified() const
const LateParsedTypeAttrInfoList & getLateAttributes() const
static const TST TST_fract
SourceLocation getThreadStorageClassSpecLoc() const
Decl * getRepAsDecl() const
static const TST TST_float16
static bool isTransformTypeTrait(TST T)
static const TST TST_unspecified
SourceLocation getAtomicSpecLoc() const
SourceLocation getVirtualSpecLoc() const
TypeSpecifierSign getTypeSpecSign() const
SourceLocation getConstexprSpecLoc() const
CXXScopeSpec & getTypeSpecScope()
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
SourceLocation getTypeSpecTypeLoc() const
OverflowBehaviorState getOverflowBehaviorState() const
void UpdateExprRep(Expr *Rep)
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, TypeResult Rep, const PrintingPolicy &Policy)
static const TST TST_decltype_auto
static const TSCS TSCS_thread_local
void setExternInLinkageSpec(bool Value)
static const TST TST_error
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal32
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
TypeSpecifierWidth getTypeSpecWidth() const
ExplicitSpecifier getExplicitSpecifier() const
static const TST TST_char32
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal128
bool isTypeSpecOwned() const
SourceLocation getTypeSpecSatLoc() const
SourceRange getTypeofParensRange() const
SourceLocation getInlineSpecLoc() const
SourceLocation getUnalignedSpecLoc() const
static const TST TST_int128
void CheckTypeSpec(Sema &S, const PrintingPolicy &Policy)
SourceLocation getVolatileSpecLoc() const
FriendSpecified isFriendSpecified() const
bool hasExplicitSpecifier() const
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool hasConstexprSpecifier() const
static const TST TST_typeofType
TemplateIdAnnotation * TemplateIdRep
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_auto
ParsedSpecifiers
ParsedSpecifiers - Flags to query which specifiers were applied.
@ PQ_StorageClassSpecifier
ConstexprSpecKind getConstexprSpecifier() const
static const TST TST_struct
Decl - This represents one declaration (or definition), e.g.
Information about one declarator, including the parsed type information and the identifier.
DeclaratorChunk & getTypeObject(unsigned i)
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
LateParsedTypeAttrInfoList & getLateAttributes()
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear.
bool isArrayOfUnknownBound() const
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of un...
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function.
void SetRangeBegin(SourceLocation Loc)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
bool hasAttributes() const
hasAttributes - do we contain any attributes?
void setCommaLoc(SourceLocation CL)
bool hasPackIndexing() const
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk,...
void AddTypeInfo(const DeclaratorChunk &TI, AttributePool &OtherPool, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
Expr * getAsmLabel() const
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
FunctionDefinitionKind getFunctionDefinitionKind() const
const ParsedAttributes & getAttributes() const
void setRedeclaration(bool Val)
bool isObjCWeakProperty() const
SourceLocation getIdentifierLoc() const
void SetIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
bool mayOmitIdentifier() const
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
void setDeclarationLateAttrs(LateParsedAttrList *L)
SourceLocation getEndLoc() const LLVM_READONLY
void setObjCIvar(bool Val=true)
bool mayBeFollowedByCXXDirectInit() const
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initiali...
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
bool isExpressionContext() const
Determine whether this declaration appears in a context where an expression could appear.
Expr * getPackIndexingExpr() const
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
void takeAttributesAppending(ParsedAttributes &attrs)
takeAttributesAppending - Takes attributes from the given ParsedAttributes set and add them to this d...
bool hasGroupingParens() const
void setDecompositionBindings(SourceLocation LSquareLoc, MutableArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
void setInvalidType(bool Val=true)
void DropFirstTypeObject()
TemplateParameterList * getInventedTemplateParameterList() const
The template parameter list generated from the explicit template parameters along with any invented t...
void SetSourceRange(SourceRange R)
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool mayHaveIdentifier() const
mayHaveIdentifier - Return true if the identifier is either optional or required.
void setGroupingParens(bool flag)
const DeclaratorChunk * getOutermostNonParenChunk() const
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chu...
bool isRedeclaration() const
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
const ParsedAttributesView & getDeclarationAttributes() const
Declarator(const DeclSpec &DS, const ParsedAttributesView &DeclarationAttrs, DeclaratorContext C)
DS and DeclarationAttrs must outlive the Declarator.
SourceLocation getEllipsisLoc() const
DeclaratorContext getContext() const
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs, SourceLocation EndLoc, const LateParsedTypeAttrInfoList &LateAttrs={})
AddTypeInfo - Add a chunk to this declarator.
const DecompositionDeclarator & getDecompositionDeclarator() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
bool isFunctionDefinition() const
void setTrailingRequiresClause(Expr *TRC)
Sets a trailing requires clause for this declarator.
void setHasInitializer(bool Val=true)
friend struct DeclaratorChunk
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
void setTemplateParameterLists(ArrayRef< TemplateParameterList * > TPLs)
Sets the template parameter lists that preceded the declarator.
bool isFirstDeclarator() const
bool hasTrailingRequiresClause() const
Determine whether a trailing requires clause was written in this declarator.
bool hasInitializer() const
SourceLocation getCommaLoc() const
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
AttributePool & getAttributePool() const
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
The template parameter lists that preceded the declarator.
bool isFunctionDeclaratorAFunctionDeclaration() const
Return true if a function declarator at this position would be a function declaration.
ParsedType getTrailingReturnType() const
Get the trailing return type appearing (at any level) within this declarator.
void setInventedTemplateParameterList(TemplateParameterList *Invented)
Sets the template parameter list generated from the explicit template parameters along with any inven...
void clear()
Reset the contents of this Declarator.
void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
ParsedAttributes & getAttributes()
void setAsmLabel(Expr *E)
LateParsedAttrList * getDeclarationLateAttrs() const
CXXScopeSpec & getCXXScopeSpec()
void ExtendWithDeclSpec(const DeclSpec &DS)
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec,...
const LateParsedTypeAttrInfoList & getLateAttributes() const
void SetRangeEnd(SourceLocation Loc)
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
void setExtension(bool Val=true)
bool mayHaveDecompositionDeclarator() const
Return true if the context permits a C++17 decomposition declarator.
bool isInvalidType() const
bool isExplicitObjectMemberFunction()
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
void setObjCWeakProperty(bool Val=true)
bool isDecompositionDeclarator() const
Return whether this declarator is a decomposition declarator.
bool isFirstDeclarationOfMember()
Returns true if this declares a real member and not a friend.
bool isPrototypeContext() const
llvm::iterator_range< type_object_iterator > type_object_range
bool isStaticMember()
Returns true if this declares a static member.
DecompositionDeclarator::Binding InlineBindings[16]
void setPackIndexingExpr(Expr *PI)
bool getExtension() const
const DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo() const
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
void setEllipsisLoc(SourceLocation EL)
const IdentifierInfo * getIdentifier() const
A parsed C++17 decomposition declarator of the form '[' identifier-list ']'.
~DecompositionDeclarator()
DecompositionDeclarator & operator=(const DecompositionDeclarator &G)=delete
ArrayRef< Binding > bindings() const
SourceRange getSourceRange() const
DecompositionDeclarator()
SourceLocation getLSquareLoc() const
DecompositionDeclarator(const DecompositionDeclarator &G)=delete
SourceLocation getRSquareLoc() const
Store information needed for an explicit specifier.
This represents one expression.
One of these records is kept for each identifier that is lexed.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
LateParsedAttrList(bool PSoon=false, bool LateAttrParseExperimentalExtOnly=false, bool LateAttrParseTypeAttrOnly=false)
bool lateAttrParseExperimentalExtOnly() const
returns true iff the attribute to be parsed should only be late parsed if it is annotated with LateAt...
bool lateAttrParseTypeAttrOnly() const
static LateParsedAttrList forTypeAttrs()
A list for the late-parsed type attributes of a declaration specifier, declarator or declarator chunk...
This represents a decl that may have a name.
Represents C++ namespaces and their aliases.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Captures information about "declaration specifiers" specific to Objective-C.
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
ObjCPropertyAttribute::Kind getPropertyAttributes() const
IdentifierInfo * getSetterName()
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
void setSetterName(IdentifierInfo *name, SourceLocation loc)
const IdentifierInfo * getSetterName() const
ObjCDeclQualifier getObjCDeclQualifier() const
SourceLocation getGetterNameLoc() const
SourceLocation getNullabilityLoc() const
NullabilityKind getNullability() const
SourceLocation getSetterNameLoc() const
void setGetterName(IdentifierInfo *name, SourceLocation loc)
void setNullability(SourceLocation loc, NullabilityKind kind)
const IdentifierInfo * getGetterName() const
void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal)
IdentifierInfo * getGetterName()
ParsedAttr - Represents a syntactic attribute.
ParsedAttributes - A collection of parsed attributes.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
void setBegin(SourceLocation b)
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceLocation getEndLoc() const LLVM_READONLY
Stores a list of template parameters for a TemplateDecl and its derived classes.
Base wrapper for a particular "section" of type source info.
Represents a C++ unqualified-id that has been parsed.
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
Specific that this unqualified-id was parsed as a literal-operator-id.
SourceLocation getBeginLoc() const LLVM_READONLY
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced.
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
void setImplicitSelfParam(const IdentifierInfo *Id)
Specify that this unqualified-id is an implicit 'self' parameter.
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
void setDeductionGuideName(ParsedTemplateTy Template, SourceLocation TemplateLoc)
Specify that this unqualified-id was parsed as a template-name for a deduction-guide.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
void setDestructorName(SourceLocation TildeLoc, ParsedType ClassType, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a destructor name.
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
SourceLocation getEndLoc() const LLVM_READONLY
UnionParsedType DestructorName
When Kind == IK_DestructorName, the type referred to by the class-name.
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
void setConstructorName(ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a constructor name.
UnionParsedTemplateTy TemplateName
When Kind == IK_DeductionGuideName, the parsed template-name.
const IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId,...
void clear()
Clear out this unqualified-id, setting it to default (invalid) state.
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
SourceLocation getOverrideLoc() const
Specifier getLastSpecifier() const
SourceLocation getFirstLocation() const
SourceLocation getLastLocation() const
SourceLocation getAbstractLoc() const
bool isOverrideSpecified() const
SourceLocation getFinalLoc() const
bool isFinalSpecified() const
bool isFinalSpelledSealed() const
static const char * getSpecifierName(Specifier VS)
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
ObjCPropertyAttribute::Kind - list of property attributes.
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
@ Extend
Lifetime-extend along this path.
Top level wrappers for InstallAPI frontend operations.
TypeSpecifierType
Specifies the kind of type.
@ TST_typename_pack_indexing
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
OpaquePtr< TemplateName > ParsedTemplateTy
FunctionDefinitionKind
Described the kind of function definition (if any) provided for a function.
ConstexprSpecKind
Define the kind of constexpr specifier.
NullabilityKind
Describes the nullability of a particular type.
LambdaCaptureKind
The different capture forms in a lambda introducer.
UnqualifiedIdKind
Describes the kind of unqualified-id parsed.
@ IK_DeductionGuideName
A deduction-guide name (a template-name)
@ IK_ImplicitSelfParam
An implicit 'self' parameter.
@ IK_TemplateId
A template-id, e.g., f<int>.
@ IK_ConstructorTemplateId
A constructor named via a template-id.
@ IK_ConstructorName
A constructor name.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
@ IK_ConversionFunctionId
A conversion function name, e.g., operator int.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
ThreadStorageClassSpecifier
Thread storage-class-specifier.
@ TSCS_thread_local
C++11 thread_local.
@ TSCS__Thread_local
C11 _Thread_local.
@ TSCS___thread
GNU __thread.
@ CopyInit
[a = b], [a = {b}]
ActionResult< ParsedType > TypeResult
UnionOpaquePtr< QualType > UnionParsedType
@ Template
We are parsing a template declaration.
UnionOpaquePtr< TemplateName > UnionParsedTemplateTy
@ NumObjCPropertyAttrsBits
Number of bits fitting all the property attributes.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
SmallVector< LateParsedTypeAttrInfo *, 0 > LateParsedTypeAttrInfoList
The late-parsed type attributes of a declaration specifier, declarator or declarator chunk,...
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
ActionResult< Expr * > ExprResult
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Unparsed
not parsed yet
@ EST_None
no exception specification
@ EST_Dynamic
throw(T1, T2)
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 unsigned
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
unsigned hasStatic
True if this dimension included the 'static' keyword.
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
unsigned TypeQuals
For now, sema will catch these as invalid.
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier.
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
SourceLocation getTrailingReturnTypeLoc() const
Get the trailing-return-type location for this function declarator.
SourceLocation getLParenLoc() const
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed.
SourceLocation MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
SourceLocation getExceptionSpecLocBeg() const
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
AttributeFactory * QualAttrFactory
AttributeFactory for the MethodQualifiers.
SourceLocation ExceptionSpecLocEnd
The end location of the exception specification, if any.
SourceLocation EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
ArrayRef< NamedDecl * > getDeclsInPrototype() const
Get the non-parameter decls defined within this function prototype.
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
SourceLocation getRParenLoc() const
SourceLocation RefQualifierLoc
The location of the ref-qualifier, if any.
SourceLocation getExceptionSpecLocEnd() const
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier.
SourceLocation getEllipsisLoc() const
SourceLocation RParenLoc
The location of the right parenthesis in the source.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
bool isKNRPrototype() const
isKNRPrototype - Return true if this is a K&R style identifier list, like "void foo(a,...
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
DeclSpec & getOrCreateMethodQualifiers()
void freeParams()
Reset the parameter list to having zero parameters.
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceRange getExceptionSpecRange() const
SourceLocation getMutableLoc() const
Retrieve the location of the 'mutable' qualifier, if any.
SourceLocation LParenLoc
The location of the left parenthesis in the source.
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
SourceLocation ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
SourceLocation TrailingReturnTypeLoc
If HasTrailingReturnType is true, this is the location of the trailing return type.
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
const CXXScopeSpec & Scope() const
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
SourceLocation StarLoc
Location of the '*' token.
char ScopeMem[sizeof(CXXScopeSpec)]
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
const IdentifierInfo * Ident
ParamInfo(const IdentifierInfo *ident, SourceLocation iloc, Decl *param, std::unique_ptr< CachedTokens > DefArgTokens=nullptr)
unsigned AccessWrites
The access writes.
SourceLocation OverflowBehaviorLoc
The location of an __ob_wrap or __ob_trap qualifier, if any.
SourceLocation RestrictQualLoc
The location of the restrict-qualifier, if any.
SourceLocation ConstQualLoc
The location of the const-qualifier, if any.
SourceLocation VolatileQualLoc
The location of the volatile-qualifier, if any.
SourceLocation UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
SourceLocation AtomicQualLoc
The location of the _Atomic-qualifier, if any.
unsigned OverflowBehaviorIsWrap
Whether the overflow behavior qualifier is wrap (true) or trap (false).
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
One instance of this struct is used for each type in a declarator that is parsed.
SourceRange getSourceRange() const
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc, SourceLocation OverflowBehaviorLoc={}, bool OverflowBehaviorIsWrap=false)
Return a DeclaratorChunk for a pointer.
static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
LateParsedTypeAttrInfoList LateAttrList
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
static DeclaratorChunk getPipe(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
ParsedAttributesView & getAttrs()
MemberPointerTypeInfo Mem
static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
SourceLocation Loc
Loc - The place where this type was defined.
ParsedAttributesView AttrList
static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation StarLoc, SourceLocation EndLoc)
enum clang::DeclaratorChunk::@340323374315200305336204205154073066142310370142 Kind
static DeclaratorChunk getParen(SourceLocation LParenLoc, SourceLocation RParenLoc)
Return a DeclaratorChunk for a paren.
static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc, bool lvalue)
Return a DeclaratorChunk for a reference.
std::optional< ParsedAttributes > Attrs
SourceLocation EllipsisLoc
FieldDeclarator(const DeclSpec &DS, const ParsedAttributes &DeclarationAttrs)
unsigned NumExplicitTemplateParams
The number of parameters in the template parameter list that were explicitly specified by the user,...
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
unsigned AutoTemplateParameterDepth
If this is a generic lambda or abbreviated function template, use this as the depth of each 'auto' pa...
An individual capture in a lambda introducer.
SourceRange ExplicitRange
SourceLocation EllipsisLoc
ParsedType InitCaptureType
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
LambdaCaptureInitKind InitKind
LambdaIntroducer()=default
bool hasLambdaCapture() const
SmallVector< LambdaCapture, 4 > Captures
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.
SourceLocation DefaultLoc
LambdaCaptureDefault Default
Contains the lexed tokens of an attribute with arguments that may reference member variables and so n...
LateParsedTypeAttrInfo(ParsedAttr::Kind Kind, SourceLocation NameLoc)
BoundsAttributedType * TypeToComplete
The type built for this attribute during type construction, still missing the argument that hasn't be...
A late-parsed attribute that will be applied as a type attribute.
Describes how types, statements, expressions, and declarations should be printed.
Information about a template-id annotation token.
SourceLocation SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new",...
OverloadedOperatorKind Operator
The kind of overloaded operator.
Structure that packs information about the type specifiers that were written in a particular type spe...