clang 22.0.0git
SemaType.cpp File Reference
#include "TypeLocBuilder.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/LocInfoType.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaHLSL.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/Template.h"
#include "clang/Sema/TemplateInstCallback.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include <bitset>
#include <optional>
#include "clang/Basic/TransformTypeTraits.def"
#include "clang/Basic/OpenCLImageTypes.def"
#include "clang/Basic/HLSLIntangibleTypes.def"

Go to the source code of this file.

Macros

#define OBJC_POINTER_TYPE_ATTRS_CASELIST
#define CALLING_CONV_ATTRS_CASELIST
#define FUNCTION_TYPE_ATTRS_CASELIST
#define MS_TYPE_ATTRS_CASELIST
#define NULLABILITY_TYPE_ATTRS_CASELIST
#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait)
#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait)
#define GENERIC_IMAGE_TYPE(ImgType, Id)
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId)
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)

Enumerations

enum  TypeDiagSelector { TDS_Function , TDS_Pointer , TDS_ObjCObjOrBlock }
enum  TypeAttrLocation { TAL_DeclSpec , TAL_DeclChunk , TAL_DeclName }
 The location of a type attribute. More...

Functions

static bool isOmittedBlockReturnType (const Declarator &D)
 isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a omitted return type on a block literal.
static void diagnoseBadTypeAttribute (Sema &S, const ParsedAttr &attr, QualType type)
 diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type.
static void moveAttrFromListToList (ParsedAttr &attr, ParsedAttributesView &fromList, ParsedAttributesView &toList)
static void processTypeAttrs (TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, const ParsedAttributesView &attrs, CUDAFunctionTarget CFT=CUDAFunctionTarget::HostDevice)
static bool handleFunctionTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type, CUDAFunctionTarget CFT)
 Process an individual function attribute.
static bool handleMSPointerTypeQualifierAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static bool handleObjCGCTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
 handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type.
static bool handleObjCOwnershipTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
 handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type.
static bool handleObjCPointerTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static DeclaratorChunkmaybeMovePastReturnType (Declarator &declarator, unsigned i, bool onlyBlockPointers)
 Given the index of a declarator chunk, check whether that chunk directly specifies the return type of a function and, if so, find an appropriate place for it.
static void distributeObjCPointerTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType type)
 Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator itself (for which, use distributeObjCPointerTypeAttrFromDeclarator), and given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position.
static void distributeObjCPointerTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
 Distribute an objc_gc type attribute that was written on the declarator.
static void distributeFunctionTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType type)
 A function type attribute was written somewhere in a declaration other than on the declarator itself or in the decl spec.
static bool distributeFunctionTypeAttrToInnermost (TypeProcessingState &state, ParsedAttr &attr, ParsedAttributesView &attrList, QualType &declSpecType, CUDAFunctionTarget CFT)
 Try to distribute a function type attribute to the innermost function chunk or type.
static void distributeFunctionTypeAttrFromDeclSpec (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
 A function type attribute was written in the decl spec.
static void distributeFunctionTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
 A function type attribute was written on the declarator or declaration.
static void distributeTypeAttrsFromDeclarator (TypeProcessingState &state, QualType &declSpecType, CUDAFunctionTarget CFT)
 Given that there are attributes written on the declarator or declaration itself, try to distribute any type attributes to the appropriate declarator chunk.
static void maybeSynthesizeBlockSignature (TypeProcessingState &state, QualType declSpecType)
 Add a synthetic '()' to a block-literal declarator if it is required, given the return type.
static void diagnoseAndRemoveTypeQualifiers (Sema &S, const DeclSpec &DS, unsigned &TypeQuals, QualType TypeSoFar, unsigned RemoveTQs, unsigned DiagID)
static bool checkOmittedBlockReturnType (Sema &S, Declarator &declarator, QualType Result)
 Return true if this is omitted block return type.
static OpenCLAccessAttr::Spelling getImageAccess (const ParsedAttributesView &Attrs)
static UnaryTransformType::UTTKind TSTToUnaryTransformType (DeclSpec::TST SwitchTST)
static QualType ConvertDeclSpecToType (TypeProcessingState &state)
 Convert the specified declspec to the appropriate type object.
static std::string getPrintableNameForEntity (DeclarationName Entity)
static bool isDependentOrGNUAutoType (QualType T)
static QualType inferARCLifetimeForPointee (Sema &S, QualType type, SourceLocation loc, bool isReference)
 Given that we're building a pointer or reference to the given.
static std::string getFunctionQualifiersAsString (const FunctionProtoType *FnTy)
static bool checkQualifiedFunction (Sema &S, QualType T, SourceLocation Loc, QualifiedFunctionKind QFK)
 Check whether the type T is a qualified function type, and if it is, diagnose that it cannot be contained within the given kind of declarator.
static QualType deduceOpenCLPointeeAddrSpace (Sema &S, QualType PointeeType)
static ExprResult checkArraySize (Sema &S, Expr *&ArraySize, llvm::APSInt &SizeVal, unsigned VLADiag, bool VLAIsError)
 Check whether the specified array bound can be evaluated using the relevant language rules.
static bool CheckBitIntElementType (Sema &S, SourceLocation AttrLoc, const BitIntType *BIT, bool ForMatrixType=false)
static void checkExtParameterInfos (Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
 Check the extended parameter information.
static void transferARCOwnershipToDeclaratorChunk (TypeProcessingState &state, Qualifiers::ObjCLifetime ownership, unsigned chunkIndex)
static void inferARCWriteback (TypeProcessingState &state, QualType &declSpecType)
 Given that this is the declaration of a parameter under ARC, attempt to infer attributes and such for pointer-to-whatever types.
static void diagnoseRedundantReturnTypeQualifiers (Sema &S, QualType RetTy, Declarator &D, unsigned FunctionChunkIndex)
static std::pair< QualType, TypeSourceInfo * > InventTemplateParameter (TypeProcessingState &state, QualType T, TypeSourceInfo *TrailingTSI, AutoType *Auto, InventedTemplateParameterInfo &Info)
static TypeSourceInfoGetTypeSourceInfoForDeclarator (TypeProcessingState &State, QualType T, TypeSourceInfo *ReturnTypeInfo)
 Create and instantiate a TypeSourceInfo with type source information.
static QualType GetDeclSpecTypeForDeclarator (TypeProcessingState &state, TypeSourceInfo *&ReturnTypeInfo)
static void warnAboutAmbiguousFunction (Sema &S, Declarator &D, DeclaratorChunk &DeclType, QualType RT)
 Produce an appropriate diagnostic for an ambiguity between a function declarator and a C++ direct-initializer.
static void warnAboutRedundantParens (Sema &S, Declarator &D, QualType T)
 Produce an appropriate diagnostic for a declarator with top-level parentheses.
static CallingConv getCCForDeclaratorChunk (Sema &S, Declarator &D, const ParsedAttributesView &AttrList, const DeclaratorChunk::FunctionTypeInfo &FTI, unsigned ChunkIndex)
 Helper for figuring out the default CC for a function declarator type.
static bool hasNullabilityAttr (const ParsedAttributesView &attrs)
 Check whether there is a nullability attribute of any kind in the given attribute list.
static PointerDeclaratorKind classifyPointerDeclarator (Sema &S, QualType type, Declarator &declarator, PointerWrappingDeclaratorKind &wrappingKind)
 Classify the given declarator, whose type-specified is type, based on what kind of pointer it refers to.
static FileID getNullabilityCompletenessCheckFileID (Sema &S, SourceLocation loc)
template<typename DiagBuilderT>
static void fixItNullability (Sema &S, DiagBuilderT &Diag, SourceLocation PointerLoc, NullabilityKind Nullability)
 Creates a fix-it to insert a C-style nullability keyword at pointerLoc, taking into account whitespace before and after.
static void emitNullabilityConsistencyWarning (Sema &S, SimplePointerKind PointerKind, SourceLocation PointerLoc, SourceLocation PointerEndLoc)
static void checkNullabilityConsistency (Sema &S, SimplePointerKind pointerKind, SourceLocation pointerLoc, SourceLocation pointerEndLoc=SourceLocation())
 Complains about missing nullability if the file containing pointerLoc has other uses of nullability (either the keywords or the assume_nonnull pragma).
static void recordNullabilitySeen (Sema &S, SourceLocation loc)
 Marks that a nullability feature has been used in the file containing loc.
static bool hasOuterPointerLikeChunk (const Declarator &D, unsigned endIndex)
 Returns true if any of the declarator chunks before endIndex include a level of indirection: array, pointer, reference, or pointer-to-member.
static bool IsNoDerefableChunk (const DeclaratorChunk &Chunk)
template<typename AttrT>
static AttrT * createSimpleAttr (ASTContext &Ctx, ParsedAttr &AL)
static AttrcreateNullabilityAttr (ASTContext &Ctx, ParsedAttr &Attr, NullabilityKind NK)
static bool DiagnoseMultipleAddrSpaceAttributes (Sema &S, LangAS ASOld, LangAS ASNew, SourceLocation AttrLoc)
static bool shouldHaveNullability (QualType T)
static TypeSourceInfoGetFullTypeForDeclarator (TypeProcessingState &state, QualType declSpecType, TypeSourceInfo *TInfo)
static void transferARCOwnershipToDeclSpec (Sema &S, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
static void transferARCOwnership (TypeProcessingState &state, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
 Used for transferring ownership in casts resulting in l-values.
static void fillAttributedTypeLoc (AttributedTypeLoc TL, TypeProcessingState &State)
static void fillHLSLAttributedResourceTypeLoc (HLSLAttributedResourceTypeLoc TL, TypeProcessingState &State)
static void fillMatrixTypeLoc (MatrixTypeLoc MTL, const ParsedAttributesView &Attrs)
static void fillAtomicQualLoc (AtomicTypeLoc ATL, const DeclaratorChunk &Chunk)
static void fillDependentAddressSpaceTypeLoc (DependentAddressSpaceTypeLoc DASTL, const ParsedAttributesView &Attrs)
static bool BuildAddressSpaceIndex (Sema &S, LangAS &ASIdx, const Expr *AddrSpace, SourceLocation AttrLoc)
 Build an AddressSpace index from a constant expression and diagnose any errors related to invalid address_spaces.
static void HandleBTFTypeTagAttribute (QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
static void HandleAddressSpaceTypeAttribute (QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
 HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type.
static bool HandleWebAssemblyFuncrefAttr (TypeProcessingState &State, QualType &QT, ParsedAttr &PAttr)
static void HandleSwiftAttr (TypeProcessingState &State, TypeAttrLocation TAL, QualType &QT, ParsedAttr &PAttr)
static QualType rebuildAttributedTypeWithoutNullability (ASTContext &Ctx, QualType Type)
 Rebuild an attributed type without the nullability attribute on it.
static NullabilityKind mapNullabilityAttrKind (ParsedAttr::Kind kind)
 Map a nullability attribute kind to a nullability kind.
static bool CheckNullabilityTypeSpecifier (Sema &S, TypeProcessingState *State, ParsedAttr *PAttr, QualType &QT, NullabilityKind Nullability, SourceLocation NullabilityLoc, bool IsContextSensitive, bool AllowOnArrayType, bool OverrideExisting)
static bool CheckNullabilityTypeSpecifier (TypeProcessingState &State, QualType &Type, ParsedAttr &Attr, bool AllowOnArrayType)
static bool checkObjCKindOfType (TypeProcessingState &state, QualType &type, ParsedAttr &attr)
 Check the application of the Objective-C '__kindof' qualifier to the given type.
static bool distributeNullabilityTypeAttr (TypeProcessingState &state, QualType type, ParsedAttr &attr)
 Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer, block pointer, or member pointer declarator, complaining if necessary.
static AttrgetCCTypeAttr (ASTContext &Ctx, ParsedAttr &Attr)
static bool handleNonBlockingNonAllocatingTypeAttr (TypeProcessingState &TPState, ParsedAttr &PAttr, QualType &QT, FunctionTypeUnwrapper &Unwrapped)
static bool checkMutualExclusion (TypeProcessingState &state, const FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, AttributeCommonInfo::Kind OtherKind)
static bool handleArmAgnosticAttribute (Sema &S, FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr)
static bool handleArmStateAttribute (Sema &S, FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, FunctionType::ArmStateValue State)
static void HandleVectorSizeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct.
static void HandleExtVectorTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 Process the OpenCL-like ext_vector_type attribute when it occurs on a type.
static bool isPermittedNeonBaseType (QualType &Ty, VectorKind VecKind, Sema &S)
static bool verifyValidIntegerConstantExpr (Sema &S, const ParsedAttr &Attr, llvm::APSInt &Result)
static void HandleNeonVectorTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S, VectorKind VecKind)
 HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to create vector types that are mangled according to ARM's ABI.
static void HandlePtrAuthQualifier (ASTContext &Ctx, QualType &T, const ParsedAttr &Attr, Sema &S)
 Handle the __ptrauth qualifier.
static void HandleArmSveVectorBitsTypeAttr (QualType &CurType, ParsedAttr &Attr, Sema &S)
 HandleArmSveVectorBitsTypeAttr - The "arm_sve_vector_bits" attribute is used to create fixed-length versions of sizeless SVE types defined by the ACLE, such as svint32_t and svbool_t.
static void HandleArmMveStrictPolymorphismAttr (TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
static void HandleRISCVRVVVectorBitsTypeAttr (QualType &CurType, ParsedAttr &Attr, Sema &S)
 HandleRISCVRVVVectorBitsTypeAttr - The "riscv_rvv_vector_bits" attribute is used to create fixed-length versions of sizeless RVV types such as vint8m1_t_t.
static void HandleOpenCLAccessAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 Handle OpenCL Access Qualifier Attribute.
static void HandleMatrixTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 HandleMatrixTypeAttr - "matrix_type" attribute, like ext_vector_type.
static void HandleAnnotateTypeAttr (TypeProcessingState &State, QualType &CurType, const ParsedAttr &PA)
static void HandleLifetimeBoundAttr (TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
static void HandleLifetimeCaptureByAttr (TypeProcessingState &State, QualType &CurType, ParsedAttr &PA)
static void HandleHLSLParamModifierAttr (TypeProcessingState &State, QualType &CurType, const ParsedAttr &Attr, Sema &S)
static bool isMultiSubjectAttrAllowedOnType (const ParsedAttr &Attr)
static void assignInheritanceModel (Sema &S, CXXRecordDecl *RD)
 Locks in the inheritance model for the given class and all of its bases.
static unsigned getLiteralDiagFromTagKind (TagTypeKind Tag)
 Get diagnostic select index for tag kind for literal type diagnostic message.
static void BuildTypeCoupledDecls (Expr *E, llvm::SmallVectorImpl< TypeCoupledDeclRefInfo > &Decls)
static QualType GetEnumUnderlyingType (Sema &S, QualType BaseType, SourceLocation Loc)
static QualType ChangeIntegralSignedness (Sema &S, QualType BaseType, bool IsMakeSigned, SourceLocation Loc)

Macro Definition Documentation

◆ CALLING_CONV_ATTRS_CASELIST

#define CALLING_CONV_ATTRS_CASELIST
Value:
case ParsedAttr::AT_CDecl: \
case ParsedAttr::AT_FastCall: \
case ParsedAttr::AT_StdCall: \
case ParsedAttr::AT_ThisCall: \
case ParsedAttr::AT_RegCall: \
case ParsedAttr::AT_Pascal: \
case ParsedAttr::AT_SwiftCall: \
case ParsedAttr::AT_SwiftAsyncCall: \
case ParsedAttr::AT_VectorCall: \
case ParsedAttr::AT_AArch64VectorPcs: \
case ParsedAttr::AT_AArch64SVEPcs: \
case ParsedAttr::AT_DeviceKernel: \
case ParsedAttr::AT_MSABI: \
case ParsedAttr::AT_SysVABI: \
case ParsedAttr::AT_Pcs: \
case ParsedAttr::AT_IntelOclBicc: \
case ParsedAttr::AT_PreserveMost: \
case ParsedAttr::AT_PreserveAll: \
case ParsedAttr::AT_M68kRTD: \
case ParsedAttr::AT_PreserveNone: \
case ParsedAttr::AT_RISCVVectorCC: \
case ParsedAttr::AT_RISCVVLSCC

Definition at line 125 of file SemaType.cpp.

Referenced by getCCForDeclaratorChunk().

◆ FUNCTION_TYPE_ATTRS_CASELIST

#define FUNCTION_TYPE_ATTRS_CASELIST
Value:
case ParsedAttr::AT_NSReturnsRetained: \
case ParsedAttr::AT_NoReturn: \
case ParsedAttr::AT_NonBlocking: \
case ParsedAttr::AT_NonAllocating: \
case ParsedAttr::AT_Blocking: \
case ParsedAttr::AT_Allocating: \
case ParsedAttr::AT_Regparm: \
case ParsedAttr::AT_CFIUncheckedCallee: \
case ParsedAttr::AT_CFISalt: \
case ParsedAttr::AT_CmseNSCall: \
case ParsedAttr::AT_ArmStreaming: \
case ParsedAttr::AT_ArmStreamingCompatible: \
case ParsedAttr::AT_ArmPreserves: \
case ParsedAttr::AT_ArmIn: \
case ParsedAttr::AT_ArmOut: \
case ParsedAttr::AT_ArmInOut: \
case ParsedAttr::AT_ArmAgnostic: \
case ParsedAttr::AT_AnyX86NoCallerSavedRegisters: \
case ParsedAttr::AT_AnyX86NoCfCheck: \
#define CALLING_CONV_ATTRS_CASELIST
Definition SemaType.cpp:125

Definition at line 150 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

◆ GENERIC_IMAGE_TYPE

#define GENERIC_IMAGE_TYPE ( ImgType,
Id )
Value:
case DeclSpec::TST_##ImgType##_t: \
switch (getImageAccess(DS.getAttributes())) { \
case OpenCLAccessAttr::Keyword_write_only: \
Result = Context.Id##WOTy; \
break; \
case OpenCLAccessAttr::Keyword_read_write: \
Result = Context.Id##RWTy; \
break; \
case OpenCLAccessAttr::Keyword_read_only: \
Result = Context.Id##ROTy; \
break; \
case OpenCLAccessAttr::SpellingNotCalculated: \
llvm_unreachable("Spelling not yet calculated"); \
} \
break;
static OpenCLAccessAttr::Spelling getImageAccess(const ParsedAttributesView &Attrs)
Definition SemaType.cpp:871

◆ HLSL_INTANGIBLE_TYPE

#define HLSL_INTANGIBLE_TYPE ( Name,
Id,
SingletonId )
Value:
case DeclSpec::TST_##Name: \
Result = Context.SingletonId; \
break;

◆ IMAGE_TYPE

#define IMAGE_TYPE ( ImgType,
Id,
SingletonId,
Access,
Suffix )
Value:
case BuiltinType::Id: \
PrevAccessQual = #Access; \
break;

◆ MS_TYPE_ATTRS_CASELIST

#define MS_TYPE_ATTRS_CASELIST
Value:
case ParsedAttr::AT_Ptr32: \
case ParsedAttr::AT_Ptr64: \
case ParsedAttr::AT_SPtr: \
case ParsedAttr::AT_UPtr

Definition at line 173 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

◆ NULLABILITY_TYPE_ATTRS_CASELIST

#define NULLABILITY_TYPE_ATTRS_CASELIST
Value:
case ParsedAttr::AT_TypeNonNull: \
case ParsedAttr::AT_TypeNullable: \
case ParsedAttr::AT_TypeNullableResult: \
case ParsedAttr::AT_TypeNullUnspecified

Definition at line 180 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

◆ OBJC_POINTER_TYPE_ATTRS_CASELIST

#define OBJC_POINTER_TYPE_ATTRS_CASELIST
Value:
case ParsedAttr::AT_ObjCGC: \
case ParsedAttr::AT_ObjCOwnership

Definition at line 120 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

◆ TRANSFORM_TYPE_TRAIT_DEF [1/2]

#define TRANSFORM_TYPE_TRAIT_DEF ( _,
Trait )
Value:
case DeclSpec::TST_##Trait:

◆ TRANSFORM_TYPE_TRAIT_DEF [2/2]

#define TRANSFORM_TYPE_TRAIT_DEF ( Enum,
Trait )
Value:
case TST_##Trait: \
return UnaryTransformType::Enum;

Enumeration Type Documentation

◆ TypeAttrLocation

The location of a type attribute.

Enumerator
TAL_DeclSpec 

The attribute is in the decl-specifier-seq.

TAL_DeclChunk 

The attribute is part of a DeclaratorChunk.

TAL_DeclName 

The attribute is immediately after the declaration's name.

Definition at line 388 of file SemaType.cpp.

◆ TypeDiagSelector

Enumerator
TDS_Function 
TDS_Pointer 
TDS_ObjCObjOrBlock 

Definition at line 55 of file SemaType.cpp.

Function Documentation

◆ assignInheritanceModel()

◆ BuildAddressSpaceIndex()

bool BuildAddressSpaceIndex ( Sema & S,
LangAS & ASIdx,
const Expr * AddrSpace,
SourceLocation AttrLoc )
static

Build an AddressSpace index from a constant expression and diagnose any errors related to invalid address_spaces.

Returns true on successfully building an AddressSpace index.

Definition at line 6433 of file SemaType.cpp.

References clang::AANT_ArgumentIntegerConstant, clang::Sema::Context, clang::Default, clang::SemaBase::Diag(), clang::FirstTargetAddressSpace, clang::Expr::getIntegerConstantExpr(), clang::getLangASFromTargetAS(), clang::Stmt::getSourceRange(), clang::Expr::isValueDependent(), max(), and clang::Qualifiers::MaxAddressSpace.

Referenced by clang::Sema::BuildAddressSpaceAttr(), and HandleAddressSpaceTypeAttribute().

◆ BuildTypeCoupledDecls()

void BuildTypeCoupledDecls ( Expr * E,
llvm::SmallVectorImpl< TypeCoupledDeclRefInfo > & Decls )
static

Definition at line 9707 of file SemaType.cpp.

References clang::cast().

Referenced by clang::Sema::BuildCountAttributedArrayOrPointerType().

◆ ChangeIntegralSignedness()

◆ checkArraySize()

ExprResult checkArraySize ( Sema & S,
Expr *& ArraySize,
llvm::APSInt & SizeVal,
unsigned VLADiag,
bool VLAIsError )
static

Check whether the specified array bound can be evaluated using the relevant language rules.

If so, returns the possibly-converted expression and sets SizeVal to the size. If not, but the expression might be a VLA bound, returns ExprResult(). Otherwise, produces a diagnostic and returns ExprError().

Definition at line 1980 of file SemaType.cpp.

References clang::ArrayBound, clang::Sema::CheckConvertedConstantExpression(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::ASTContext::getSizeType(), clang::Expr::getType(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::T, and clang::Sema::VerifyIntegerConstantExpression().

Referenced by clang::Sema::BuildArrayType().

◆ CheckBitIntElementType()

bool CheckBitIntElementType ( Sema & S,
SourceLocation AttrLoc,
const BitIntType * BIT,
bool ForMatrixType = false )
static

◆ checkExtParameterInfos()

void checkExtParameterInfos ( Sema & S,
ArrayRef< QualType > paramTypes,
const FunctionProtoType::ExtProtoInfo & EPI,
llvm::function_ref< SourceLocation(unsigned)> getParamLoc )
static

◆ checkMutualExclusion()

bool checkMutualExclusion ( TypeProcessingState & state,
const FunctionProtoType::ExtProtoInfo & EPI,
ParsedAttr & Attr,
AttributeCommonInfo::Kind OtherKind )
static

◆ checkNullabilityConsistency()

void checkNullabilityConsistency ( Sema & S,
SimplePointerKind pointerKind,
SourceLocation pointerLoc,
SourceLocation pointerEndLoc = SourceLocation() )
static

Complains about missing nullability if the file containing pointerLoc has other uses of nullability (either the keywords or the assume_nonnull pragma).

If the file has not seen other uses of nullability, this particular pointer is saved for possible later diagnosis. See recordNullabilitySeen().

Definition at line 4112 of file SemaType.cpp.

References clang::Sema::Context, emitNullabilityConsistencyWarning(), clang::ASTContext::getDiagnostics(), getNullabilityCompletenessCheckFileID(), clang::DiagnosticsEngine::isIgnored(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), clang::Sema::NullabilityMap, clang::FileNullability::PointerEndLoc, clang::FileNullability::PointerKind, clang::FileNullability::PointerLoc, and clang::FileNullability::SawTypeNullability.

Referenced by GetFullTypeForDeclarator().

◆ CheckNullabilityTypeSpecifier() [1/2]

◆ CheckNullabilityTypeSpecifier() [2/2]

bool CheckNullabilityTypeSpecifier ( TypeProcessingState & State,
QualType & Type,
ParsedAttr & Attr,
bool AllowOnArrayType )
static

◆ checkObjCKindOfType()

bool checkObjCKindOfType ( TypeProcessingState & state,
QualType & type,
ParsedAttr & attr )
static

◆ checkOmittedBlockReturnType()

bool checkOmittedBlockReturnType ( Sema & S,
Declarator & declarator,
QualType Result )
static

◆ checkQualifiedFunction()

bool checkQualifiedFunction ( Sema & S,
QualType T,
SourceLocation Loc,
QualifiedFunctionKind QFK )
static

Check whether the type T is a qualified function type, and if it is, diagnose that it cannot be contained within the given kind of declarator.

Definition at line 1771 of file SemaType.cpp.

References clang::SemaBase::Diag(), clang::Qualifiers::empty(), getFunctionQualifiersAsString(), clang::FunctionProtoType::getMethodQuals(), clang::FunctionProtoType::getRefQualifier(), clang::RQ_None, and clang::T.

Referenced by clang::Sema::BuildBlockPointerType(), clang::Sema::BuildPointerType(), and clang::Sema::BuildReferenceType().

◆ classifyPointerDeclarator()

PointerDeclaratorKind classifyPointerDeclarator ( Sema & S,
QualType type,
Declarator & declarator,
PointerWrappingDeclaratorKind & wrappingKind )
static

◆ ConvertDeclSpecToType()

QualType ConvertDeclSpecToType ( TypeProcessingState & state)
static

Convert the specified declspec to the appropriate type object.

Parameters
stateSpecifies the declarator containing the declaration specifier to be converted, along with other associated processing state.
Returns
The type described by the declaration specifiers. This function never returns null.

Definition at line 896 of file SemaType.cpp.

References clang::ParsedAttributesView::addAtEnd(), clang::AltiVecBool, clang::AltiVecPixel, clang::AltiVecVector, clang::TemplateArgumentListInfo::arguments(), clang::Auto, clang::BlockLiteral, clang::Sema::BuildAtomicType(), clang::Sema::BuildBitIntType(), clang::Sema::BuildDecltypeType(), clang::Sema::BuildPackIndexingType(), clang::Sema::BuildQualifiedType(), clang::Sema::BuildTypeofExprType(), clang::Sema::BuildUnaryTransformType(), clang::cast(), checkOmittedBlockReturnType(), clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::DecltypeAuto, clang::SemaBase::Diag(), diagnoseAndRemoveTypeQualifiers(), clang::Sema::DiagnoseUseOfDecl(), clang::DeclSpec::getAttributes(), clang::ASTContext::getAutoType(), clang::DeclSpec::getBeginLoc(), clang::DeclSpec::getConstSpecLoc(), clang::Declarator::getContext(), clang::Declarator::getDeclarationAttributes(), clang::DeclSpec::getEllipsisLoc(), clang::Declarator::getIdentifierLoc(), clang::KeywordHelpers::getKeywordForTypeSpec(), clang::Sema::getLangOpts(), clang::Declarator::getMutableDeclSpec(), clang::LangOptions::getOpenCLCompatibleVersion(), clang::Sema::getOpenCLOptions(), clang::DeclSpec::getPackIndexingExpr(), clang::DeclSpec::getRepAsDecl(), clang::DeclSpec::getRepAsExpr(), clang::DeclSpec::getRepAsTemplateId(), clang::DeclSpec::getRepAsType(), clang::CXXScopeSpec::getScopeRep(), clang::DeclSpec::getSourceRange(), clang::DeclSpec::getSpecifierName(), clang::DeclSpec::getStorageClassSpec(), clang::ASTContext::getTargetInfo(), clang::Sema::GetTypeFromParser(), clang::DeclSpec::getTypeQualifiers(), clang::DeclSpec::getTypeSpecComplex(), clang::DeclSpec::getTypeSpecComplexLoc(), clang::DeclSpec::getTypeSpecSatLoc(), clang::DeclSpec::getTypeSpecScope(), clang::DeclSpec::getTypeSpecSign(), clang::DeclSpec::getTypeSpecSignLoc(), clang::DeclSpec::getTypeSpecType(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::DeclSpec::getTypeSpecTypeNameLoc(), clang::DeclSpec::getTypeSpecWidth(), clang::DeclSpec::getTypeSpecWidthLoc(), clang::DeclSpec::getVolatileSpecLoc(), clang::GNUAutoType, clang::TargetInfo::hasBFloat16Type(), clang::TargetInfo::hasBitIntType(), clang::TargetInfo::hasFloat128Type(), clang::TargetInfo::hasFloat16Type(), clang::TargetInfo::hasIbm128Type(), clang::TargetInfo::hasInt128Type(), clang::DeclSpec::hasTypeSpecifier(), clang::Sema::HLSL(), clang::OpenCLOptions::isAvailableOption(), clang::DeclSpec::isConstrainedAuto(), clang::LangOptions::isImplicitIntAllowed(), clang::LangOptions::isImplicitIntRequired(), clang::SourceLocation::isInvalid(), clang::OpenCLOptions::isSupported(), clang::LangOptions::isTargetDevice(), clang::DeclSpec::isTypeAltiVecBool(), clang::DeclSpec::isTypeAltiVecPixel(), clang::DeclSpec::isTypeAltiVecVector(), clang::DeclSpec::isTypeSpecOwned(), clang::DeclSpec::isTypeSpecPipe(), clang::DeclSpec::isTypeSpecSat(), clang::Keyword, clang::LambdaExpr, clang::Long, clang::LongLong, maybeSynthesizeBlockSignature(), clang::SemaHLSL::ProcessResourceTypeAttributes(), processTypeAttrs(), clang::Qualified, clang::DeclSpec::SCS_typedef, clang::Declarator::setInvalidType(), clang::TemplateArgumentListInfo::setLAngleLoc(), clang::TemplateArgumentListInfo::setRAngleLoc(), clang::Short, clang::Signed, TAL_DeclSpec, clang::DeclSpec::TQ_atomic, clang::DeclSpec::TQ_const, clang::DeclSpec::TQ_volatile, clang::Sema::translateTemplateArguments(), clang::DeclSpec::TSC_complex, clang::DeclSpec::TSC_imaginary, clang::DeclSpec::TST_accum, clang::DeclSpec::TST_atomic, clang::DeclSpec::TST_auto, clang::DeclSpec::TST_auto_type, clang::DeclSpec::TST_BFloat16, clang::DeclSpec::TST_bitint, clang::DeclSpec::TST_bool, clang::DeclSpec::TST_char, clang::DeclSpec::TST_char16, clang::DeclSpec::TST_char32, clang::DeclSpec::TST_char8, clang::DeclSpec::TST_class, clang::DeclSpec::TST_decimal128, clang::DeclSpec::TST_decimal32, clang::DeclSpec::TST_decimal64, clang::DeclSpec::TST_decltype, clang::DeclSpec::TST_decltype_auto, clang::DeclSpec::TST_double, clang::DeclSpec::TST_enum, clang::DeclSpec::TST_error, clang::DeclSpec::TST_float, clang::DeclSpec::TST_float128, clang::DeclSpec::TST_float16, clang::DeclSpec::TST_fract, clang::DeclSpec::TST_half, clang::DeclSpec::TST_ibm128, clang::DeclSpec::TST_int, clang::DeclSpec::TST_int128, clang::DeclSpec::TST_interface, clang::DeclSpec::TST_struct, clang::DeclSpec::TST_typename, clang::DeclSpec::TST_typename_pack_indexing, clang::DeclSpec::TST_typeof_unqualExpr, clang::DeclSpec::TST_typeof_unqualType, clang::DeclSpec::TST_typeofExpr, clang::DeclSpec::TST_typeofType, clang::DeclSpec::TST_union, clang::DeclSpec::TST_unknown_anytype, clang::DeclSpec::TST_unspecified, clang::DeclSpec::TST_void, clang::DeclSpec::TST_wchar, TSTToUnaryTransformType(), clang::Unqualified, clang::Unsigned, and clang::Unspecified.

Referenced by GetDeclSpecTypeForDeclarator().

◆ createNullabilityAttr()

◆ createSimpleAttr()

◆ deduceOpenCLPointeeAddrSpace()

◆ diagnoseAndRemoveTypeQualifiers()

◆ diagnoseBadTypeAttribute()

void diagnoseBadTypeAttribute ( Sema & S,
const ParsedAttr & attr,
QualType type )
static

◆ DiagnoseMultipleAddrSpaceAttributes()

bool DiagnoseMultipleAddrSpaceAttributes ( Sema & S,
LangAS ASOld,
LangAS ASNew,
SourceLocation AttrLoc )
static

◆ diagnoseRedundantReturnTypeQualifiers()

void diagnoseRedundantReturnTypeQualifiers ( Sema & S,
QualType RetTy,
Declarator & D,
unsigned FunctionChunkIndex )
static

Definition at line 2944 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::PointerTypeInfo::AtomicQualLoc, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::PointerTypeInfo::ConstQualLoc, clang::Sema::diagnoseIgnoredQualifiers(), clang::DeclaratorChunk::Fun, clang::DeclaratorChunk::Function, clang::DeclSpec::getAtomicSpecLoc(), clang::DeclSpec::getConstSpecLoc(), clang::QualType::getCVRQualifiers(), clang::Declarator::getDeclSpec(), clang::Declarator::getIdentifierLoc(), clang::UnqualifiedId::getKind(), clang::QualType::getLocalCVRQualifiers(), clang::Declarator::getName(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getRestrictSpecLoc(), clang::DeclaratorChunk::FunctionTypeInfo::getTrailingReturnTypeLoc(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeQualifiers(), clang::DeclSpec::getUnalignedSpecLoc(), clang::DeclSpec::getVolatileSpecLoc(), clang::DeclaratorChunk::FunctionTypeInfo::hasTrailingReturnType(), clang::IK_ConversionFunctionId, clang::Type::isAtomicType(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Ptr, clang::DeclaratorChunk::Reference, clang::DeclaratorChunk::PointerTypeInfo::RestrictQualLoc, clang::DeclSpec::TQ_atomic, clang::DeclaratorChunk::PointerTypeInfo::TypeQuals, clang::DeclaratorChunk::PointerTypeInfo::UnalignedQualLoc, and clang::DeclaratorChunk::PointerTypeInfo::VolatileQualLoc.

Referenced by GetFullTypeForDeclarator().

◆ distributeFunctionTypeAttr()

void distributeFunctionTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType type )
static

A function type attribute was written somewhere in a declaration other than on the declarator itself or in the decl spec.

Given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position.

Definition at line 616 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, diagnoseBadTypeAttribute(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ast_matchers::type.

Referenced by processTypeAttrs().

◆ distributeFunctionTypeAttrFromDeclarator()

void distributeFunctionTypeAttrFromDeclarator ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & declSpecType,
CUDAFunctionTarget CFT )
static

A function type attribute was written on the declarator or declaration.

Try to apply it somewhere. Attrs is the attribute list containing the declaration (either of the declarator or the declaration).

Definition at line 687 of file SemaType.cpp.

References distributeFunctionTypeAttrToInnermost(), clang::Declarator::getAttributes(), and clang::ParsedAttributesView::remove().

Referenced by distributeTypeAttrsFromDeclarator().

◆ distributeFunctionTypeAttrFromDeclSpec()

void distributeFunctionTypeAttrFromDeclSpec ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & declSpecType,
CUDAFunctionTarget CFT )
static

A function type attribute was written in the decl spec.

Try to apply it somewhere.

Definition at line 667 of file SemaType.cpp.

References distributeFunctionTypeAttrToInnermost().

Referenced by processTypeAttrs().

◆ distributeFunctionTypeAttrToInnermost()

bool distributeFunctionTypeAttrToInnermost ( TypeProcessingState & state,
ParsedAttr & attr,
ParsedAttributesView & attrList,
QualType & declSpecType,
CUDAFunctionTarget CFT )
static

Try to distribute a function type attribute to the innermost function chunk or type.

Returns true if the attribute was distributed, false if no location was found.

Definition at line 647 of file SemaType.cpp.

References clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), handleFunctionTypeAttr(), clang::DeclaratorChunk::Kind, and moveAttrFromListToList().

Referenced by distributeFunctionTypeAttrFromDeclarator(), and distributeFunctionTypeAttrFromDeclSpec().

◆ distributeNullabilityTypeAttr()

bool distributeNullabilityTypeAttr ( TypeProcessingState & state,
QualType type,
ParsedAttr & attr )
static

Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer, block pointer, or member pointer declarator, complaining if necessary.

Returns
true if the nullability annotation was distributed, false otherwise.

Attempt to move the attribute to the specified chunk.

Definition at line 7455 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getTypeObject(), hasNullabilityAttr(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::Loc, mapNullabilityAttrKind(), maybeMovePastReturnType(), clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ast_matchers::type.

Referenced by processTypeAttrs().

◆ distributeObjCPointerTypeAttr()

void distributeObjCPointerTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType type )
static

Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator itself (for which, use distributeObjCPointerTypeAttrFromDeclarator), and given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position.

Definition at line 499 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, diagnoseBadTypeAttribute(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, maybeMovePastReturnType(), clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ast_matchers::type.

Referenced by processTypeAttrs().

◆ distributeObjCPointerTypeAttrFromDeclarator()

◆ distributeTypeAttrsFromDeclarator()

void distributeTypeAttrsFromDeclarator ( TypeProcessingState & state,
QualType & declSpecType,
CUDAFunctionTarget CFT )
static

Given that there are attributes written on the declarator or declaration itself, try to distribute any type attributes to the appropriate declarator chunk.

These are attributes like the following: int f ATTR; int (f ATTR)(); but not necessarily this: int f() ATTR;

Attrs is the attribute list containing the declaration (either of the declarator or the declaration).

Definition at line 716 of file SemaType.cpp.

References distributeFunctionTypeAttrFromDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), FUNCTION_TYPE_ATTRS_CASELIST, MS_TYPE_ATTRS_CASELIST, NULLABILITY_TYPE_ATTRS_CASELIST, and OBJC_POINTER_TYPE_ATTRS_CASELIST.

Referenced by GetDeclSpecTypeForDeclarator().

◆ emitNullabilityConsistencyWarning()

void emitNullabilityConsistencyWarning ( Sema & S,
SimplePointerKind PointerKind,
SourceLocation PointerLoc,
SourceLocation PointerEndLoc )
static

◆ fillAtomicQualLoc()

◆ fillAttributedTypeLoc()

void fillAttributedTypeLoc ( AttributedTypeLoc TL,
TypeProcessingState & State )
static

◆ fillDependentAddressSpaceTypeLoc()

◆ fillHLSLAttributedResourceTypeLoc()

◆ fillMatrixTypeLoc()

◆ fixItNullability()

template<typename DiagBuilderT>
void fixItNullability ( Sema & S,
DiagBuilderT & Diag,
SourceLocation PointerLoc,
NullabilityKind Nullability )
static

◆ getCCForDeclaratorChunk()

CallingConv getCCForDeclaratorChunk ( Sema & S,
Declarator & D,
const ParsedAttributesView & AttrList,
const DeclaratorChunk::FunctionTypeInfo & FTI,
unsigned ChunkIndex )
static

◆ getCCTypeAttr()

Attr * getCCTypeAttr ( ASTContext & Ctx,
ParsedAttr & Attr )
static

Definition at line 7536 of file SemaType.cpp.

References clang::cast(), createSimpleAttr(), and clang::Attr::getKind().

Referenced by handleFunctionTypeAttr().

◆ GetDeclSpecTypeForDeclarator()

QualType GetDeclSpecTypeForDeclarator ( TypeProcessingState & state,
TypeSourceInfo *& ReturnTypeInfo )
static

Definition at line 3120 of file SemaType.cpp.

References clang::AliasDecl, clang::AliasTemplate, clang::Association, clang::Auto, clang::Block, clang::BlockLiteral, clang::cast(), clang::Class, clang::Condition, clang::Sema::Context, clang::UnqualifiedId::ConversionFunctionId, clang::ConversionId, ConvertDeclSpecToType(), clang::Sema::CUDA(), clang::Sema::CurContext, clang::CXXCatch, clang::CXXNew, clang::DecltypeAuto, clang::ASTContext::DependentTy, clang::SemaBase::Diag(), distributeTypeAttrsFromDeclarator(), clang::Enum, clang::Error, clang::File, clang::ForInit, clang::FunctionalCast, clang::TemplateName::getAsTemplateDecl(), clang::Declarator::getAttributes(), clang::DeclSpec::getAttributes(), clang::SourceRange::getBegin(), clang::ASTContext::getCanonicalTagType(), clang::Declarator::getContext(), clang::Sema::getCurLambda(), clang::Sema::getCurScope(), clang::Declarator::getDeclSpec(), clang::UnqualifiedId::getKind(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Declarator::getMutableDeclSpec(), clang::Declarator::getName(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getParsedSpecifiers(), clang::DeclSpec::getRepAsDecl(), clang::UnqualifiedId::getSourceRange(), clang::DeclSpec::getStorageClassSpec(), clang::Sema::getTemplateNameKindForDiagnostics(), clang::Declarator::getTrailingReturnType(), clang::Sema::GetTypeFromParser(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::GNUAutoType, clang::Declarator::hasTrailingReturnType(), clang::SemaCUDA::IdentifyTarget(), clang::IK_ConstructorName, clang::IK_ConstructorTemplateId, clang::IK_ConversionFunctionId, clang::IK_DeductionGuideName, clang::IK_DestructorName, clang::IK_Identifier, clang::IK_ImplicitSelfParam, clang::IK_LiteralOperatorId, clang::IK_OperatorFunctionId, clang::IK_TemplateId, int, clang::Interface, clang::ASTContext::IntTy, clang::Sema::InventedParameterInfos, InventTemplateParameter(), clang::isa(), clang::TagDecl::isCompleteDefinition(), clang::DeclSpec::isFriendSpecified(), clang::Scope::isFunctionDeclarationScope(), clang::Declarator::isFunctionDeclarator(), clang::Declarator::isInvalidType(), clang::Declarator::isStaticMember(), clang::DeclSpec::isTypeSpecOwned(), clang::KNRTypeList, clang::LambdaExpr, clang::LambdaExprParameter, clang::Member, clang::Sema::NoteTemplateLocation(), clang::nullptr, clang::ObjCCatch, clang::ObjCParameter, clang::ObjCResult, clang::DeclSpec::PQ_TypeSpecifier, processTypeAttrs(), clang::Prototype, clang::RequiresExpr, clang::DeclSpec::SCS_typedef, clang::SelectionInit, clang::TagDecl::setEmbeddedInDeclarator(), clang::Declarator::setInvalidType(), clang::Struct, clang::T, TAL_DeclSpec, clang::TemplateArg, clang::TemplateName, clang::TemplateParam, clang::TemplateTypeArg, clang::TrailingReturn, clang::TrailingReturnVar, clang::TypeName, clang::Union, and clang::ASTContext::VoidTy.

Referenced by clang::Sema::GetTypeForDeclarator(), and clang::Sema::GetTypeForDeclaratorCast().

◆ GetEnumUnderlyingType()

◆ GetFullTypeForDeclarator()

TypeSourceInfo * GetFullTypeForDeclarator ( TypeProcessingState & state,
QualType declSpecType,
TypeSourceInfo * TInfo )
static

Never complain.

Complain on the inner pointers (but not the outermost pointer).

Complain about any pointers that don't have nullability specified or inferred.

Definition at line 4267 of file SemaType.cpp.

References clang::Qualifiers::addAddressSpace(), clang::ParsedAttributesView::addAtEnd(), clang::Qualifiers::addCVRUQualifiers(), clang::AliasDecl, clang::AliasTemplate, clang::LangOptions::allowArrayReturnTypes(), clang::TargetInfo::allowHalfArgsAndReturns(), clang::DeclaratorChunk::Arr, clang::DeclaratorChunk::Array, clang::Association, clang::Auto, clang::Block, clang::BlockLiteral, clang::DeclaratorChunk::BlockPointer, clang::Sema::BuildArrayType(), clang::Sema::BuildBlockPointerType(), clang::Sema::BuildMemberPointerType(), clang::Sema::BuildParenType(), clang::Sema::BuildPointerType(), clang::Sema::BuildQualifiedType(), clang::Sema::BuildReadPipeType(), clang::Sema::BuildReferenceType(), clang::C, clang::cast(), clang::Sema::CheckDistantExceptionSpec(), clang::Sema::checkExceptionSpecification(), checkExtParameterInfos(), checkNullabilityConsistency(), classifyPointerDeclarator(), clang::DeclaratorChunk::Cls, clang::Sema::CodeSynthesisContexts, clang::Sema::computeDeclContext(), clang::Condition, clang::Constexpr, clang::Sema::Context, clang::ConversionId, clang::FixItHint::CreateInsertion(), createNullabilityAttr(), clang::FixItHint::CreateRemoval(), clang::Sema::CUDA(), clang::CXXCatch, clang::CXXNew, clang::Default, clang::Definition, clang::SemaBase::Diag(), Diag(), DiagnoseMultipleAddrSpaceAttributes(), diagnoseRedundantReturnTypeQualifiers(), clang::ObjCDeclSpec::DQ_CSNullability, clang::FunctionProtoType::ExtProtoInfo::EllipsisLoc, clang::DeclaratorChunk::EndLoc, clang::EST_Dynamic, clang::DeclaratorChunk::FunctionTypeInfo::Exceptions, clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec, clang::FunctionProtoType::ExtProtoInfo::ExtInfo, clang::FunctionProtoType::ExtProtoInfo::ExtParameterInfos, clang::File, clang::First, fixItNullability(), clang::DeclSpec::forEachQualifier(), clang::ForInit, clang::DeclaratorChunk::Fun, clang::DeclaratorChunk::Function, clang::FunctionalCast, clang::Type::getAs(), clang::DeclSpec::getAttributePool(), clang::Declarator::getAttributes(), clang::DeclSpec::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::CharSourceRange::getBegin(), clang::Declarator::getBeginLoc(), clang::DeclSpec::getBeginLoc(), clang::TypeLoc::getBeginLoc(), clang::ASTContext::getBuiltinVaListDecl(), getCCForDeclaratorChunk(), clang::DeclSpec::getConstexprSpecifier(), clang::Declarator::getContext(), clang::Sema::getCurLambda(), clang::Declarator::getCXXScopeSpec(), clang::Declarator::getDeclarationAttributes(), clang::Declarator::getDeclSpec(), clang::Sema::getDefaultCXXMethodAddrSpace(), clang::Declarator::getEllipsisLoc(), clang::DeclaratorChunk::FunctionTypeInfo::getEllipsisLoc(), clang::DeclSpec::getEndLoc(), clang::TypeLoc::getEndLoc(), clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecLocBeg(), clang::DeclaratorChunk::FunctionTypeInfo::getExceptionSpecType(), clang::FunctionProtoType::getExtProtoInfo(), clang::Declarator::getFunctionDefinitionKind(), getFunctionQualifiersAsString(), clang::Declarator::getIdentifier(), clang::Declarator::getIdentifierLoc(), clang::SourceManager::getImmediateExpansionRange(), clang::Declarator::getInnermostNonParenChunk(), clang::SemaHLSL::getInoutParameterType(), clang::UnqualifiedId::getKind(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getLocForEndOfToken(), clang::DeclaratorChunk::FunctionTypeInfo::getLParenLoc(), clang::FunctionProtoType::getMethodQuals(), clang::Declarator::getMutableDeclSpec(), clang::Declarator::getName(), clang::IdentifierInfo::getName(), clang::Sema::getNullabilityKeyword(), clang::DeclaratorChunk::FunctionTypeInfo::getNumExceptions(), clang::Declarator::getNumTypeObjects(), clang::LangOptions::getOpenCLCompatibleVersion(), clang::Sema::getOpenCLOptions(), clang::FunctionProtoType::getParamTypes(), clang::Preprocessor::getPragmaAssumeNonNullLoc(), clang::FunctionProtoType::getRefQualifier(), clang::DeclaratorChunk::FunctionTypeInfo::getRefQualifierLoc(), clang::DeclSpec::getRepAsDecl(), clang::FunctionType::getReturnType(), clang::DeclaratorChunk::FunctionTypeInfo::getRParenLoc(), clang::Sema::getSourceManager(), clang::Declarator::getSourceRange(), clang::DeclSpec::getSourceRange(), clang::DeclSpec::getStorageClassSpec(), clang::ASTContext::getTargetInfo(), clang::DeclaratorChunk::FunctionTypeInfo::getTrailingReturnType(), clang::DeclaratorChunk::FunctionTypeInfo::getTrailingReturnTypeLoc(), clang::Sema::GetTypeFromParser(), clang::TypeSourceInfo::getTypeLoc(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeQualifiers(), clang::TypeLocBuilder::getTypeSourceInfo(), GetTypeSourceInfoForDeclarator(), clang::DeclSpec::getTypeSpecType(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::ParsedAttributesView::hasAttribute(), clang::DeclSpec::hasAutoTypeSpec(), clang::Declarator::hasEllipsis(), clang::DeclaratorChunk::FunctionTypeInfo::hasMethodTypeQualifiers(), clang::ParsedAttributesView::hasMSPropertyAttr(), hasNullabilityAttr(), hasOuterPointerLikeChunk(), clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype, clang::QualType::hasQualifiers(), clang::DeclaratorChunk::FunctionTypeInfo::hasRefQualifier(), clang::DeclaratorChunk::ReferenceTypeInfo::HasRestrict, clang::DeclaratorChunk::ArrayTypeInfo::hasStatic, clang::DeclSpec::hasTagDefinition(), clang::FunctionProtoType::ExtProtoInfo::HasTrailingReturn, clang::DeclaratorChunk::FunctionTypeInfo::hasTrailingReturnType(), clang::Sema::HLSL(), clang::DeclaratorChunk::ParamInfo::Ident, clang::SemaCUDA::IdentifyTarget(), clang::DeclaratorChunk::ParamInfo::IdentLoc, clang::IK_ConversionFunctionId, clang::IK_DeductionGuideName, clang::Sema::InventedParameterInfos, InventTemplateParameter(), clang::isa(), clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous, clang::OpenCLOptions::isAvailableOption(), clang::Type::isBlockPointerType(), clang::isComputedNoexcept(), clang::Declarator::isExplicitObjectMemberFunction(), clang::DeclSpec::isFriendSpecified(), clang::Declarator::isFunctionDeclarationContext(), clang::Declarator::isFunctionDeclarator(), clang::Type::isHalfType(), clang::CXXScopeSpec::isInvalid(), clang::SourceLocation::isInvalid(), clang::Declarator::isInvalidType(), clang::SourceLocation::isMacroID(), IsNoDerefableChunk(), clang::QualType::isNull(), clang::Declarator::isPrototypeContext(), clang::DeclContext::isRecord(), clang::CXXScopeSpec::isSet(), clang::DeclaratorChunk::ArrayTypeInfo::isStar, clang::Declarator::isStaticMember(), clang::SourceLocation::isValid(), clang::DeclaratorChunk::FunctionTypeInfo::isVariadic, clang::Type::isVoidType(), clang::DeclaratorChunk::Kind, clang::KNRTypeList, clang::LambdaExpr, clang::LambdaExprParameter, clang::DeclaratorChunk::Loc, clang::DeclaratorChunk::ReferenceTypeInfo::LValueRef, clang::DeclaratorChunk::Mem, clang::Member, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::FunctionTypeInfo::MethodQualifiers, clang::DeclaratorChunk::FunctionTypeInfo::NoexceptExpr, clang::NonNull, clang::Normal, clang::Nullable, clang::DeclaratorChunk::ArrayTypeInfo::NumElts, clang::DeclaratorChunk::FunctionTypeInfo::NumParams, clang::ObjCCatch, clang::ObjCParameter, clang::ObjCResult, clang::DeclaratorChunk::ParamInfo::Param, clang::DeclaratorChunk::FunctionTypeInfo::Params, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::Sema::PP, processTypeAttrs(), clang::Prototype, clang::DeclaratorChunk::Ptr, clang::TypeLocBuilder::push(), clang::TypeLocBuilder::pushFullCopy(), clang::DeclaratorChunk::TypeAndRange::Range, recordNullabilitySeen(), clang::DeclaratorChunk::Ref, clang::DeclaratorChunk::Reference, clang::FunctionProtoType::ExtProtoInfo::RefQualifier, clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierIsLValueRef, clang::Qualifiers::removeCVRQualifiers(), clang::RequiresExpr, clang::LangOptions::requiresStrictPrototypes(), clang::Qualifiers::Restrict, clang::RQ_LValue, clang::RQ_None, clang::RQ_RValue, clang::DeclaratorChunk::MemberPointerTypeInfo::Scope(), clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_typedef, clang::SelectionInit, clang::Declarator::setEllipsisLoc(), clang::Declarator::setInvalidType(), clang::ObjCObjectPointerTypeLoc::setStarLoc(), shouldHaveNullability(), clang::Sema::SourceMgr, clang::Star, clang::Static, clang::T, TAL_DeclChunk, TAL_DeclName, TAL_DeclSpec, clang::TemplateArg, clang::TemplateParam, clang::TemplateTypeArg, clang::DeclSpec::TQ_const, clang::TrailingReturn, clang::TrailingReturnVar, clang::DeclSpec::TST_auto, clang::DeclaratorChunk::TypeAndRange::Ty, clang::NestedNameSpecifier::Type, clang::Declarator::type_objects(), clang::TypeName, clang::DeclaratorChunk::ArrayTypeInfo::TypeQuals, clang::DeclaratorChunk::BlockPointerTypeInfo::TypeQuals, clang::DeclaratorChunk::MemberPointerTypeInfo::TypeQuals, clang::DeclaratorChunk::PointerTypeInfo::TypeQuals, clang::FunctionProtoType::ExtProtoInfo::TypeQuals, clang::FunctionProtoType::ExtProtoInfo::Variadic, warnAboutAmbiguousFunction(), and warnAboutRedundantParens().

Referenced by clang::Sema::GetTypeForDeclarator(), and clang::Sema::GetTypeForDeclaratorCast().

◆ getFunctionQualifiersAsString()

◆ getImageAccess()

OpenCLAccessAttr::Spelling getImageAccess ( const ParsedAttributesView & Attrs)
static

Definition at line 871 of file SemaType.cpp.

◆ getLiteralDiagFromTagKind()

unsigned getLiteralDiagFromTagKind ( TagTypeKind Tag)
static

Get diagnostic select index for tag kind for literal type diagnostic message.

WARNING: Indexes apply to particular diagnostics only!

Returns
diagnostic select index.

Definition at line 9585 of file SemaType.cpp.

References clang::Class, clang::Interface, and clang::Struct.

Referenced by clang::Sema::RequireLiteralType().

◆ getNullabilityCompletenessCheckFileID()

◆ getPrintableNameForEntity()

std::string getPrintableNameForEntity ( DeclarationName Entity)
static

◆ GetTypeSourceInfoForDeclarator()

◆ HandleAddressSpaceTypeAttribute()

void HandleAddressSpaceTypeAttribute ( QualType & Type,
const ParsedAttr & Attr,
TypeProcessingState & State )
static

◆ HandleAnnotateTypeAttr()

◆ handleArmAgnosticAttribute()

◆ HandleArmMveStrictPolymorphismAttr()

void HandleArmMveStrictPolymorphismAttr ( TypeProcessingState & State,
QualType & CurType,
ParsedAttr & Attr )
static

◆ handleArmStateAttribute()

◆ HandleArmSveVectorBitsTypeAttr()

void HandleArmSveVectorBitsTypeAttr ( QualType & CurType,
ParsedAttr & Attr,
Sema & S )
static

◆ HandleBTFTypeTagAttribute()

void HandleBTFTypeTagAttribute ( QualType & Type,
const ParsedAttr & Attr,
TypeProcessingState & State )
static

◆ HandleExtVectorTypeAttr()

void HandleExtVectorTypeAttr ( QualType & CurType,
const ParsedAttr & Attr,
Sema & S )
static

Process the OpenCL-like ext_vector_type attribute when it occurs on a type.

Definition at line 8291 of file SemaType.cpp.

References clang::Sema::BuildExtVectorType(), clang::SemaBase::Diag(), clang::AttributeCommonInfo::getLoc(), and clang::T.

Referenced by processTypeAttrs().

◆ handleFunctionTypeAttr()

bool handleFunctionTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & type,
CUDAFunctionTarget CFT )
static

Process an individual function attribute.

Returns true to indicate that the attribute was handled, false if it wasn't.

Definition at line 7828 of file SemaType.cpp.

References clang::ASTContext::adjustFunctionType(), clang::FunctionType::ARM_In, clang::FunctionType::ARM_InOut, clang::FunctionType::ARM_Out, clang::FunctionType::ARM_Preserves, clang::cast(), clang::CC_X86FastCall, clang::CC_X86StdCall, clang::FunctionType::FunctionTypeExtraAttributeInfo::CFISalt, clang::Sema::CheckAttrNoArgs(), clang::Sema::CheckAttrTarget(), clang::Sema::CheckCallingConvAttr(), checkMutualExclusion(), clang::SemaObjC::checkNSReturnsRetainedReturnType(), clang::Sema::CheckRegparmAttr(), clang::Sema::checkStringLiteralArgumentAttr(), clang::Sema::Context, createSimpleAttr(), clang::SemaBase::Diag(), clang::Equivalent, clang::EST_BasicNoexcept, clang::EST_DependentNoexcept, clang::EST_Dynamic, clang::EST_DynamicNone, clang::EST_MSAny, clang::EST_NoexceptFalse, clang::EST_NoexceptTrue, clang::EST_None, clang::EST_NoThrow, clang::EST_Unevaluated, clang::EST_Uninstantiated, clang::EST_Unparsed, clang::ExpectedFunctionWithProtoType, clang::FunctionProtoType::ExtProtoInfo::ExtraAttributeInfo, clang::Type::getAs(), clang::FunctionType::getCallConv(), clang::Sema::getCallingConvAttributedType(), getCCTypeAttr(), clang::ASTContext::getFunctionType(), clang::ASTContext::getFunctionTypeWithExceptionSpec(), clang::FunctionType::getHasRegParm(), clang::Sema::getLangOpts(), clang::FunctionType::getNameForCallConv(), handleArmAgnosticAttribute(), handleArmStateAttribute(), handleNonBlockingNonAllocatingTypeAttr(), int, clang::FunctionProtoType::isVariadic(), clang::Sema::ObjC(), clang::FunctionProtoType::ExtProtoInfo::setArmSMEAttribute(), clang::FunctionType::SME_PStateSMCompatibleMask, clang::FunctionType::SME_PStateSMEnabledMask, clang::supportsVariadicCall(), clang::ast_matchers::type, and clang::Sema::VariadicFunction.

Referenced by distributeFunctionTypeAttrToInnermost(), and processTypeAttrs().

◆ HandleHLSLParamModifierAttr()

void HandleHLSLParamModifierAttr ( TypeProcessingState & State,
QualType & CurType,
const ParsedAttr & Attr,
Sema & S )
static

Definition at line 8791 of file SemaType.cpp.

References clang::Type::isDependentType().

Referenced by processTypeAttrs().

◆ HandleLifetimeBoundAttr()

void HandleLifetimeBoundAttr ( TypeProcessingState & State,
QualType & CurType,
ParsedAttr & Attr )
static

◆ HandleLifetimeCaptureByAttr()

void HandleLifetimeCaptureByAttr ( TypeProcessingState & State,
QualType & CurType,
ParsedAttr & PA )
static

Definition at line 8782 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleMatrixTypeAttr()

void HandleMatrixTypeAttr ( QualType & CurType,
const ParsedAttr & Attr,
Sema & S )
static

HandleMatrixTypeAttr - "matrix_type" attribute, like ext_vector_type.

Definition at line 8720 of file SemaType.cpp.

References clang::Sema::BuildMatrixType(), clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::AttributeCommonInfo::getLoc(), and clang::T.

Referenced by processTypeAttrs().

◆ handleMSPointerTypeQualifierAttr()

◆ HandleNeonVectorTypeAttr()

void HandleNeonVectorTypeAttr ( QualType & CurType,
const ParsedAttr & Attr,
Sema & S,
VectorKind VecKind )
static

HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to create vector types that are mangled according to ARM's ABI.

Otherwise, these types are identical to those created with the "vector_size" attribute. Unlike "vector_size" the argument to these Neon attributes is the number of vector elements, not the vector size in bytes. The vector width and element type must match one of the standard Neon vector types.

Definition at line 8378 of file SemaType.cpp.

References clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::AttributeCommonInfo::getLoc(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::ASTContext::getTypeSize(), clang::ASTContext::getVectorType(), clang::TargetInfo::hasFeature(), isPermittedNeonBaseType(), clang::LangOptions::isTargetDevice(), clang::Neon, clang::NeonPoly, and verifyValidIntegerConstantExpr().

Referenced by processTypeAttrs().

◆ handleNonBlockingNonAllocatingTypeAttr()

◆ handleObjCGCTypeAttr()

bool handleObjCGCTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & type )
static

handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type.

Returns true to indicate that the attribute was handled, false to indicate that the type does not permit the attribute.

Definition at line 6817 of file SemaType.cpp.

References clang::AANT_ArgumentString, clang::Sema::Context, clang::SemaBase::Diag(), clang::Qualifiers::GCNone, clang::ASTContext::getObjCGCQualType(), clang::IdentifierInfo::isStr(), clang::Qualifiers::Strong, clang::ast_matchers::type, and clang::Qualifiers::Weak.

Referenced by handleObjCPointerTypeAttr().

◆ handleObjCOwnershipTypeAttr()

bool handleObjCOwnershipTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & type )
static

◆ handleObjCPointerTypeAttr()

bool handleObjCPointerTypeAttr ( TypeProcessingState & state,
ParsedAttr & attr,
QualType & type )
static

◆ HandleOpenCLAccessAttr()

◆ HandlePtrAuthQualifier()

◆ HandleRISCVRVVVectorBitsTypeAttr()

◆ HandleSwiftAttr()

◆ HandleVectorSizeAttr()

void HandleVectorSizeAttr ( QualType & CurType,
const ParsedAttr & Attr,
Sema & S )
static

HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct.

Aggregates with this attribute are invalid, even if they are of the same size as a corresponding scalar. The raw attribute should contain precisely 1 argument, the vector size for the variable, measured in bytes. If curType and rawAttr are well formed, this routine will return a new vector type.

Definition at line 8271 of file SemaType.cpp.

References clang::Sema::BuildVectorType(), clang::SemaBase::Diag(), clang::AttributeCommonInfo::getLoc(), and clang::T.

Referenced by processTypeAttrs().

◆ HandleWebAssemblyFuncrefAttr()

◆ hasNullabilityAttr()

bool hasNullabilityAttr ( const ParsedAttributesView & attrs)
static

Check whether there is a nullability attribute of any kind in the given attribute list.

Definition at line 3829 of file SemaType.cpp.

Referenced by distributeNullabilityTypeAttr(), and GetFullTypeForDeclarator().

◆ hasOuterPointerLikeChunk()

bool hasOuterPointerLikeChunk ( const Declarator & D,
unsigned endIndex )
static

Returns true if any of the declarator chunks before endIndex include a level of indirection: array, pointer, reference, or pointer-to-member.

Because declarator chunks are stored in outer-to-inner order, testing every chunk before endIndex is testing all chunks that embed the current chunk as part of their type.

It is legal to pass the result of Declarator::getNumTypeObjects() as the end index, in which case all chunks are tested.

Definition at line 4182 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.

Referenced by GetFullTypeForDeclarator(), and processTypeAttrs().

◆ inferARCLifetimeForPointee()

◆ inferARCWriteback()

◆ InventTemplateParameter()

std::pair< QualType, TypeSourceInfo * > InventTemplateParameter ( TypeProcessingState & state,
QualType T,
TypeSourceInfo * TrailingTSI,
AutoType * Auto,
InventedTemplateParameterInfo & Info )
static

Definition at line 3015 of file SemaType.cpp.

References clang::TemplateArgumentListInfo::addArgument(), clang::TemplateArgumentListInfo::arguments(), clang::Sema::AttachTypeConstraint(), clang::Auto, clang::InventedTemplateParameterInfo::AutoTemplateParameterDepth, clang::cast(), clang::Sema::Context, clang::TemplateTypeParmDecl::Create(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::OpaquePtr< PtrTy >::get(), clang::AutoTypeLoc::getArgLoc(), clang::TemplateName::getAsTemplateDecl(), clang::TemplateName::getAsUsingShadowDecl(), clang::AutoTypeLoc::getConceptNameInfo(), clang::TypeLoc::getContainedAutoTypeLoc(), clang::Declarator::getDeclSpec(), clang::Declarator::getEllipsisLoc(), clang::AutoTypeLoc::getFoundDecl(), clang::Declarator::getIdentifier(), clang::Declarator::getIdentifierLoc(), clang::AutoTypeLoc::getLAngleLoc(), clang::AutoTypeLoc::getNamedConcept(), clang::AutoTypeLoc::getNestedNameSpecifierLoc(), clang::AutoTypeLoc::getNumArgs(), clang::AutoTypeLoc::getRAngleLoc(), clang::DeclSpec::getRepAsTemplateId(), clang::TemplateIdAnnotation::getTemplateArgs(), clang::ASTContext::getTranslationUnitDecl(), clang::TypeDecl::getTypeForDecl(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclSpec::getTypeSpecScope(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::CXXScopeSpec::getWithLocInContext(), clang::Declarator::hasEllipsis(), clang::AutoTypeLoc::hasExplicitTemplateArgs(), clang::Invalid, clang::Sema::InventAbbreviatedTemplateParameterTypeName(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), clang::TemplateIdAnnotation::LAngleLoc, clang::TemplateIdAnnotation::Name, clang::TemplateIdAnnotation::NumArgs, clang::TemplateIdAnnotation::RAngleLoc, clang::Sema::ReplaceAutoTypeSourceInfo(), clang::Decl::setImplicit(), clang::T, clang::TemplateIdAnnotation::Template, clang::TemplateIdAnnotation::TemplateNameLoc, clang::InventedTemplateParameterInfo::TemplateParams, clang::Sema::translateTemplateArguments(), and clang::Sema::UPPC_TypeConstraint.

Referenced by GetDeclSpecTypeForDeclarator(), and GetFullTypeForDeclarator().

◆ isDependentOrGNUAutoType()

bool isDependentOrGNUAutoType ( QualType T)
static

Definition at line 1571 of file SemaType.cpp.

References clang::T.

Referenced by clang::Sema::BuildAtomicType(), and clang::Sema::BuildQualifiedType().

◆ isMultiSubjectAttrAllowedOnType()

bool isMultiSubjectAttrAllowedOnType ( const ParsedAttr & Attr)
static

Definition at line 8805 of file SemaType.cpp.

References clang::Attr::getKind().

Referenced by processTypeAttrs().

◆ IsNoDerefableChunk()

bool IsNoDerefableChunk ( const DeclaratorChunk & Chunk)
static

◆ isOmittedBlockReturnType()

bool isOmittedBlockReturnType ( const Declarator & D)
static

isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a omitted return type on a block literal.

Definition at line 63 of file SemaType.cpp.

References clang::BlockLiteral, clang::DeclaratorChunk::Function, clang::Declarator::getContext(), clang::Declarator::getDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), clang::DeclSpec::hasTypeSpecifier(), and clang::DeclaratorChunk::Kind.

Referenced by checkOmittedBlockReturnType().

◆ isPermittedNeonBaseType()

◆ mapNullabilityAttrKind()

NullabilityKind mapNullabilityAttrKind ( ParsedAttr::Kind kind)
static

Map a nullability attribute kind to a nullability kind.

Definition at line 7242 of file SemaType.cpp.

References clang::NonNull, clang::Nullable, clang::NullableResult, and clang::Unspecified.

Referenced by CheckNullabilityTypeSpecifier(), and distributeNullabilityTypeAttr().

◆ maybeMovePastReturnType()

DeclaratorChunk * maybeMovePastReturnType ( Declarator & declarator,
unsigned i,
bool onlyBlockPointers )
static

Given the index of a declarator chunk, check whether that chunk directly specifies the return type of a function and, if so, find an appropriate place for it.

Parameters
i- a notional index which the search will start immediately inside
onlyBlockPointersWhether we should only look into block pointer types (vs. all pointer types).

Definition at line 431 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.

Referenced by distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), and handleObjCOwnershipTypeAttr().

◆ maybeSynthesizeBlockSignature()

void maybeSynthesizeBlockSignature ( TypeProcessingState & state,
QualType declSpecType )
static

◆ moveAttrFromListToList()

◆ processTypeAttrs()

void processTypeAttrs ( TypeProcessingState & state,
QualType & type,
TypeAttrLocation TAL,
const ParsedAttributesView & attrs,
CUDAFunctionTarget CFT = CUDAFunctionTarget::HostDevice )
static

Definition at line 8815 of file SemaType.cpp.

References clang::cast(), CheckNullabilityTypeSpecifier(), checkObjCKindOfType(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), createSimpleAttr(), diagnoseBadTypeAttribute(), distributeFunctionTypeAttr(), distributeFunctionTypeAttrFromDeclSpec(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), clang::ParsedAttributesView::empty(), FUNCTION_TYPE_ATTRS_CASELIST, HandleAddressSpaceTypeAttribute(), HandleAnnotateTypeAttr(), HandleArmMveStrictPolymorphismAttr(), HandleArmSveVectorBitsTypeAttr(), HandleBTFTypeTagAttribute(), HandleExtVectorTypeAttr(), handleFunctionTypeAttr(), HandleHLSLParamModifierAttr(), HandleLifetimeBoundAttr(), HandleLifetimeCaptureByAttr(), HandleMatrixTypeAttr(), handleMSPointerTypeQualifierAttr(), HandleNeonVectorTypeAttr(), handleObjCPointerTypeAttr(), HandleOpenCLAccessAttr(), HandlePtrAuthQualifier(), HandleRISCVRVVVectorBitsTypeAttr(), HandleSwiftAttr(), HandleVectorSizeAttr(), HandleWebAssemblyFuncrefAttr(), hasOuterPointerLikeChunk(), clang::AttributeCommonInfo::IgnoredAttribute, clang::isa(), isMultiSubjectAttrAllowedOnType(), MS_TYPE_ATTRS_CASELIST, clang::Neon, clang::NeonPoly, NULLABILITY_TYPE_ATTRS_CASELIST, OBJC_POINTER_TYPE_ATTRS_CASELIST, TAL_DeclChunk, TAL_DeclName, TAL_DeclSpec, clang::ast_matchers::type, and clang::AttributeCommonInfo::UnknownAttribute.

Referenced by ConvertDeclSpecToType(), GetDeclSpecTypeForDeclarator(), and GetFullTypeForDeclarator().

◆ rebuildAttributedTypeWithoutNullability()

QualType rebuildAttributedTypeWithoutNullability ( ASTContext & Ctx,
QualType Type )
static

Rebuild an attributed type without the nullability attribute on it.

Definition at line 7222 of file SemaType.cpp.

References clang::ASTContext::getAttributedType(), clang::QualType::getTypePtr(), and rebuildAttributedTypeWithoutNullability().

Referenced by CheckNullabilityTypeSpecifier(), and rebuildAttributedTypeWithoutNullability().

◆ recordNullabilitySeen()

void recordNullabilitySeen ( Sema & S,
SourceLocation loc )
static

Marks that a nullability feature has been used in the file containing loc.

If this file already had pointer types in it that were missing nullability, the first such instance is retroactively diagnosed.

See also
checkNullabilityConsistency

Definition at line 4153 of file SemaType.cpp.

References emitNullabilityConsistencyWarning(), getNullabilityCompletenessCheckFileID(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), clang::Sema::NullabilityMap, clang::FileNullability::PointerEndLoc, clang::FileNullability::PointerKind, clang::FileNullability::PointerLoc, and clang::FileNullability::SawTypeNullability.

Referenced by CheckNullabilityTypeSpecifier(), and GetFullTypeForDeclarator().

◆ shouldHaveNullability()

bool shouldHaveNullability ( QualType T)
static

Definition at line 4257 of file SemaType.cpp.

References clang::isa(), and clang::T.

Referenced by GetFullTypeForDeclarator().

◆ transferARCOwnership()

◆ transferARCOwnershipToDeclaratorChunk()

◆ transferARCOwnershipToDeclSpec()

◆ TSTToUnaryTransformType()

UnaryTransformType::UTTKind TSTToUnaryTransformType ( DeclSpec::TST SwitchTST)
static

Definition at line 879 of file SemaType.cpp.

Referenced by ConvertDeclSpecToType().

◆ verifyValidIntegerConstantExpr()

◆ warnAboutAmbiguousFunction()

void warnAboutAmbiguousFunction ( Sema & S,
Declarator & D,
DeclaratorChunk & DeclType,
QualType RT )
static

Produce an appropriate diagnostic for an ambiguity between a function declarator and a C++ direct-initializer.

Definition at line 3472 of file SemaType.cpp.

References clang::Condition, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::FixItHint::CreateReplacement(), clang::Sema::CurContext, clang::Declaration, clang::SemaBase::Diag(), clang::DeclaratorChunk::EndLoc, clang::DeclaratorChunk::Fun, clang::Type::getAsCXXRecordDecl(), clang::SourceRange::getBegin(), clang::Declarator::getCommaLoc(), clang::Declarator::getContext(), clang::Sema::getCurScope(), clang::Declarator::getDeclSpec(), clang::FullSourceLoc::getFileID(), clang::Sema::getFixItZeroInitializerForType(), clang::Declarator::getFunctionDefinitionKind(), clang::Declarator::getIdentifier(), clang::Declarator::getIdentifierLoc(), clang::Sema::getLocForEndOfToken(), clang::Decl::getSourceRange(), clang::FullSourceLoc::getSpellingLineNumber(), clang::DeclSpec::getStorageClassSpec(), clang::CXXRecordDecl::hasDefinition(), clang::CXXRecordDecl::hasUserProvidedDefaultConstructor(), clang::Init, clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous, clang::CXXRecordDecl::isEmpty(), clang::Declarator::isFirstDeclarator(), clang::Declarator::isFunctionDeclarator(), clang::DeclContext::isFunctionOrMethod(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isVoidType(), clang::Sema::LangOpts, clang::DeclaratorChunk::Loc, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::DeclaratorChunk::FunctionTypeInfo::NumParams, clang::DeclaratorChunk::ParamInfo::Param, clang::DeclaratorChunk::FunctionTypeInfo::Params, clang::Result, clang::DeclSpec::SCS_unspecified, and clang::Sema::SourceMgr.

Referenced by GetFullTypeForDeclarator().

◆ warnAboutRedundantParens()

void warnAboutRedundantParens ( Sema & S,
Declarator & D,
QualType T )
static

Produce an appropriate diagnostic for a declarator with top-level parentheses.

Definition at line 3569 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::C, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::CXXNew, clang::SemaBase::Diag(), clang::DeclaratorChunk::Function, clang::NestedNameSpecifier::getAsNamespaceAndPrefix(), clang::NestedNameSpecifier::getAsType(), clang::Declarator::getBeginLoc(), clang::Declarator::getContext(), clang::Sema::getCurScope(), clang::Declarator::getCXXScopeSpec(), clang::Declarator::getDeclSpec(), clang::Declarator::getEndLoc(), clang::Declarator::getIdentifier(), clang::NestedNameSpecifier::getKind(), clang::Sema::getLangOpts(), clang::Sema::getLocForEndOfToken(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getParsedSpecifiers(), clang::Type::getPrefix(), clang::CXXScopeSpec::getScopeRep(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeQualifiers(), clang::NestedNameSpecifier::Global, clang::Sema::inTemplateInstantiation(), clang::Declarator::isExpressionContext(), clang::Declarator::isFirstDeclarator(), clang::Declarator::isInvalidType(), clang::CXXScopeSpec::isValid(), clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::DeclaratorChunk::MemberPointer, clang::NestedNameSpecifier::Namespace, clang::out, clang::DeclaratorChunk::Paren, Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclSpec::PQ_TypeSpecifier, clang::NamespaceAndPrefix::Prefix, clang::DeclaratorChunk::Reference, clang::Result, clang::T, clang::NestedNameSpecifier::Type, and clang::Declarator::type_objects().

Referenced by GetFullTypeForDeclarator().