clang  19.0.0git
Macros | Enumerations | Functions
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/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/PartialDiagnostic.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/ParsedTemplate.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaInternal.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/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include <bitset>
#include <optional>
#include "clang/Basic/TransformTypeTraits.def"
#include "clang/Basic/OpenCLImageTypes.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)   case DeclSpec::TST_##Trait:
 
#define GENERIC_IMAGE_TYPE(ImgType, Id)
 
#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. More...
 
static void diagnoseBadTypeAttribute (Sema &S, const ParsedAttr &attr, QualType type)
 diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type. More...
 
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. More...
 
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. More...
 
static bool handleObjCOwnershipTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
 handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type. More...
 
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. More...
 
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. More...
 
static void distributeObjCPointerTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
 Distribute an objc_gc type attribute that was written on the declarator. More...
 
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. More...
 
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. More...
 
static void distributeFunctionTypeAttrFromDeclSpec (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
 A function type attribute was written in the decl spec. More...
 
static void distributeFunctionTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
 A function type attribute was written on the declarator or declaration. More...
 
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. More...
 
static void maybeSynthesizeBlockSignature (TypeProcessingState &state, QualType declSpecType)
 Add a synthetic '()' to a block-literal declarator if it is required, given the return type. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static void checkExtParameterInfos (Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
 Check the extended parameter information. More...
 
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. More...
 
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. More...
 
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. More...
 
static void warnAboutRedundantParens (Sema &S, Declarator &D, QualType T)
 Produce an appropriate diagnostic for a declarator with top-level parentheses. More...
 
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. More...
 
static bool hasNullabilityAttr (const ParsedAttributesView &attrs)
 Check whether there is a nullability attribute of any kind in the given attribute list. More...
 
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. More...
 
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. More...
 
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). More...
 
static void recordNullabilitySeen (Sema &S, SourceLocation loc)
 Marks that a nullability feature has been used in the file containing loc. More...
 
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. More...
 
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. More...
 
static void fillAttributedTypeLoc (AttributedTypeLoc 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. More...
 
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. More...
 
static void HandleSYCLPipeAttribute (QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
 
static bool HandleWebAssemblyFuncrefAttr (TypeProcessingState &State, QualType &QT, ParsedAttr &PAttr)
 
static QualType rebuildAttributedTypeWithoutNullability (ASTContext &Ctx, QualType Type)
 Rebuild an attributed type without the nullability attribute on it. More...
 
static NullabilityKind mapNullabilityAttrKind (ParsedAttr::Kind kind)
 Map a nullability attribute kind to a nullability kind. More...
 
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. More...
 
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. More...
 
static AttrgetCCTypeAttr (ASTContext &Ctx, ParsedAttr &Attr)
 
static bool checkMutualExclusion (TypeProcessingState &state, const FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, AttributeCommonInfo::Kind OtherKind)
 
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. More...
 
static void HandleExtVectorTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 Process the OpenCL-like ext_vector_type attribute when it occurs on a type. More...
 
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. More...
 
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. More...
 
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. More...
 
static void HandleOpenCLAccessAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 Handle OpenCL Access Qualifier Attribute. More...
 
static void HandleMatrixTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 HandleMatrixTypeAttr - "matrix_type" attribute, like ext_vector_type. More...
 
static void HandleAnnotateTypeAttr (TypeProcessingState &State, QualType &CurType, const ParsedAttr &PA)
 
static void HandleLifetimeBoundAttr (TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
 
static void HandleHLSLParamModifierAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
 
static void assignInheritanceModel (Sema &S, CXXRecordDecl *RD)
 Locks in the inheritance model for the given class and all of its bases. More...
 
static unsigned getLiteralDiagFromTagKind (TagTypeKind Tag)
 Get diagnostic select index for tag kind for literal type diagnostic message. More...
 
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_AMDGPUKernelCall: \
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

Definition at line 125 of file SemaType.cpp.

◆ FUNCTION_TYPE_ATTRS_CASELIST

#define FUNCTION_TYPE_ATTRS_CASELIST
Value:
case ParsedAttr::AT_NSReturnsRetained: \
case ParsedAttr::AT_NoReturn: \
case ParsedAttr::AT_Regparm: \
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_AnyX86NoCallerSavedRegisters: \
case ParsedAttr::AT_AnyX86NoCfCheck: \
CALLING_CONV_ATTRS_CASELIST

Definition at line 149 of file SemaType.cpp.

◆ 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:859

◆ IMAGE_TYPE

#define IMAGE_TYPE (   ImgType,
  Id,
  SingletonId,
  Access,
  Suffix 
)
Value:
PrevAccessQual = #Access; \
break;
int Id
Definition: ASTDiff.cpp:190

◆ 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 165 of file SemaType.cpp.

◆ 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 172 of file SemaType.cpp.

◆ 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.

◆ TRANSFORM_TYPE_TRAIT_DEF [1/2]

#define TRANSFORM_TYPE_TRAIT_DEF (   _,
  Trait 
)    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 376 of file SemaType.cpp.

◆ TypeDiagSelector

Enumerator
TDS_Function 
TDS_Pointer 
TDS_ObjCObjOrBlock 

Definition at line 55 of file SemaType.cpp.

Function Documentation

◆ assignInheritanceModel()

static void assignInheritanceModel ( Sema S,
CXXRecordDecl RD 
)
static

Locks in the inheritance model for the given class and all of its bases.

Definition at line 9069 of file SemaType.cpp.

◆ BuildAddressSpaceIndex()

static 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 6436 of file SemaType.cpp.

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

◆ BuildTypeCoupledDecls()

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

Definition at line 9433 of file SemaType.cpp.

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

◆ ChangeIntegralSignedness()

static QualType ChangeIntegralSignedness ( Sema S,
QualType  BaseType,
bool  IsMakeSigned,
SourceLocation  Loc 
)
static

Definition at line 9713 of file SemaType.cpp.

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

◆ checkArraySize()

static 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 2015 of file SemaType.cpp.

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

◆ checkExtParameterInfos()

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

Check the extended parameter information.

Most of the necessary checking should occur when applying the parameter attribute; the only other checks required are positional restrictions.

Definition at line 2620 of file SemaType.cpp.

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

◆ checkMutualExclusion()

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

Definition at line 7607 of file SemaType.cpp.

◆ checkNullabilityConsistency()

static 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 4152 of file SemaType.cpp.

◆ CheckNullabilityTypeSpecifier() [1/2]

static bool CheckNullabilityTypeSpecifier ( Sema S,
TypeProcessingState *  State,
ParsedAttr PAttr,
QualType QT,
NullabilityKind  Nullability,
SourceLocation  NullabilityLoc,
bool  IsContextSensitive,
bool  AllowOnArrayType,
bool  OverrideExisting 
)
static

◆ CheckNullabilityTypeSpecifier() [2/2]

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

◆ checkObjCKindOfType()

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

Check the application of the Objective-C '__kindof' qualifier to the given type.

Definition at line 7403 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ checkOmittedBlockReturnType()

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

Return true if this is omitted block return type.

Also check type attributes and type qualifiers when returning true.

Definition at line 829 of file SemaType.cpp.

◆ checkQualifiedFunction()

static 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 1752 of file SemaType.cpp.

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

◆ classifyPointerDeclarator()

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

Classify the given declarator, whose type-specified is type, based on what kind of pointer it refers to.

This is used to determine the default nullability.

Definition at line 3914 of file SemaType.cpp.

◆ ConvertDeclSpecToType()

static 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 884 of file SemaType.cpp.

Referenced by GetDeclSpecTypeForDeclarator().

◆ createNullabilityAttr()

static Attr* createNullabilityAttr ( ASTContext Ctx,
ParsedAttr Attr,
NullabilityKind  NK 
)
static

◆ createSimpleAttr()

template<typename AttrT >
static AttrT* createSimpleAttr ( ASTContext Ctx,
ParsedAttr AL 
)
static

Definition at line 4252 of file SemaType.cpp.

References clang::ParsedAttr::setUsedAsTypeAttr().

◆ deduceOpenCLPointeeAddrSpace()

static QualType deduceOpenCLPointeeAddrSpace ( Sema S,
QualType  PointeeType 
)
static

◆ diagnoseAndRemoveTypeQualifiers()

static void diagnoseAndRemoveTypeQualifiers ( Sema S,
const DeclSpec DS,
unsigned TypeQuals,
QualType  TypeSoFar,
unsigned  RemoveTQs,
unsigned  DiagID 
)
static

Definition at line 801 of file SemaType.cpp.

◆ diagnoseBadTypeAttribute()

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

diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type.

Definition at line 80 of file SemaType.cpp.

Referenced by distributeFunctionTypeAttr(), distributeObjCPointerTypeAttr(), and processTypeAttrs().

◆ DiagnoseMultipleAddrSpaceAttributes()

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

Definition at line 4279 of file SemaType.cpp.

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

◆ diagnoseRedundantReturnTypeQualifiers()

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

Definition at line 2991 of file SemaType.cpp.

◆ distributeFunctionTypeAttr()

static 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 604 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::ast_matchers::attr, 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()

static 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 675 of file SemaType.cpp.

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

Referenced by distributeTypeAttrsFromDeclarator().

◆ distributeFunctionTypeAttrFromDeclSpec()

static 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 655 of file SemaType.cpp.

References clang::ast_matchers::attr, and distributeFunctionTypeAttrToInnermost().

Referenced by processTypeAttrs().

◆ distributeFunctionTypeAttrToInnermost()

static 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 635 of file SemaType.cpp.

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

Referenced by distributeFunctionTypeAttrFromDeclarator(), and distributeFunctionTypeAttrFromDeclSpec().

◆ distributeNullabilityTypeAttr()

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

◆ distributeObjCPointerTypeAttr()

static 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 487 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::ast_matchers::attr, 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()

static void distributeObjCPointerTypeAttrFromDeclarator ( TypeProcessingState &  state,
ParsedAttr attr,
QualType declSpecType 
)
static

◆ distributeTypeAttrsFromDeclarator()

static 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 704 of file SemaType.cpp.

References clang::ast_matchers::attr, distributeFunctionTypeAttrFromDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), FUNCTION_TYPE_ATTRS_CASELIST, MS_TYPE_ATTRS_CASELIST, NULLABILITY_TYPE_ATTRS_CASELIST, and OBJC_POINTER_TYPE_ATTRS_CASELIST.

Referenced by GetDeclSpecTypeForDeclarator().

◆ emitNullabilityConsistencyWarning()

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

Definition at line 4118 of file SemaType.cpp.

◆ fillAtomicQualLoc()

static void fillAtomicQualLoc ( AtomicTypeLoc  ATL,
const DeclaratorChunk Chunk 
)
static

◆ fillAttributedTypeLoc()

static void fillAttributedTypeLoc ( AttributedTypeLoc  TL,
TypeProcessingState &  State 
)
static

◆ fillDependentAddressSpaceTypeLoc()

static void fillDependentAddressSpaceTypeLoc ( DependentAddressSpaceTypeLoc  DASTL,
const ParsedAttributesView Attrs 
)
static

◆ fillMatrixTypeLoc()

static void fillMatrixTypeLoc ( MatrixTypeLoc  MTL,
const ParsedAttributesView Attrs 
)
static

◆ fixItNullability()

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

Creates a fix-it to insert a C-style nullability keyword at pointerLoc, taking into account whitespace before and after.

Definition at line 4083 of file SemaType.cpp.

◆ getCCForDeclaratorChunk()

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

Helper for figuring out the default CC for a function declarator type.

If this is the outermost chunk, then we can determine the CC from the declarator context. If not, then this could be either a member function type or normal function type.

Definition at line 3733 of file SemaType.cpp.

◆ getCCTypeAttr()

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

Definition at line 7542 of file SemaType.cpp.

References clang::Attr::getKind().

◆ GetDeclSpecTypeForDeclarator()

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

Definition at line 3169 of file SemaType.cpp.

References clang::AliasDecl, clang::AliasTemplate, clang::Association, clang::Auto, clang::Block, clang::BlockLiteral, 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::File, clang::ForInit, clang::FunctionalCast, clang::TemplateName::getAsTemplateDecl(), clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::SourceRange::getBegin(), clang::Type::getContainedDeducedType(), 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::ASTContext::getTypeDeclType(), 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::TagDecl::isCompleteDefinition(), clang::DeclSpec::isFriendSpecified(), clang::Scope::isFunctionDeclarationScope(), clang::Declarator::isFunctionDeclarator(), clang::Declarator::isInvalidType(), clang::DeclSpec::isTypeSpecOwned(), clang::KNRTypeList, clang::LambdaExpr, clang::LambdaExprParameter, clang::Member, clang::Sema::NoteTemplateLocation(), clang::ObjCCatch, clang::ObjCParameter, clang::ObjCResult, clang::DeclSpec::PQ_TypeSpecifier, processTypeAttrs(), clang::Prototype, clang::RequiresExpr, clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_typedef, clang::SelectionInit, clang::TagDecl::setEmbeddedInDeclarator(), clang::Declarator::setInvalidType(), clang::Struct, clang::T, TAL_DeclSpec, clang::TemplateArg, 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()

static QualType GetEnumUnderlyingType ( Sema S,
QualType  BaseType,
SourceLocation  Loc 
)
static

Definition at line 9590 of file SemaType.cpp.

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

◆ GetFullTypeForDeclarator()

static 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 4307 of file SemaType.cpp.

References clang::T.

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

◆ getFunctionQualifiersAsString()

static std::string getFunctionQualifiersAsString ( const FunctionProtoType FnTy)
static

◆ getImageAccess()

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

Definition at line 859 of file SemaType.cpp.

◆ getLiteralDiagFromTagKind()

static 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 9279 of file SemaType.cpp.

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

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

◆ getNullabilityCompletenessCheckFileID()

static FileID getNullabilityCompletenessCheckFileID ( Sema S,
SourceLocation  loc 
)
static

Definition at line 4043 of file SemaType.cpp.

◆ getPrintableNameForEntity()

static std::string getPrintableNameForEntity ( DeclarationName  Entity)
static

◆ GetTypeSourceInfoForDeclarator()

static TypeSourceInfo * GetTypeSourceInfoForDeclarator ( TypeProcessingState &  State,
QualType  T,
TypeSourceInfo ReturnTypeInfo 
)
static

Create and instantiate a TypeSourceInfo with type source information.

Parameters
TQualType referring to the type as written in source code.
ReturnTypeInfoFor declarators whose return type does not show up in the normal place in the declaration specifiers (such as a C++ conversion function), this pointer will refer to a type source information for that return type.

Definition at line 6293 of file SemaType.cpp.

◆ HandleAddressSpaceTypeAttribute()

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

HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type.

The attribute contains 1 argument, the id of the address space for the type.

Definition at line 6545 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleAnnotateTypeAttr()

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

Definition at line 8459 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleArmMveStrictPolymorphismAttr()

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

◆ handleArmStateAttribute()

static bool handleArmStateAttribute ( Sema S,
FunctionProtoType::ExtProtoInfo EPI,
ParsedAttr Attr,
FunctionType::ArmStateValue  State 
)
static

Definition at line 7627 of file SemaType.cpp.

◆ HandleArmSveVectorBitsTypeAttr()

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

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.

Definition at line 8229 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleBTFTypeTagAttribute()

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

Definition at line 6515 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleExtVectorTypeAttr()

static 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 8075 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ handleFunctionTypeAttr()

static 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 7675 of file SemaType.cpp.

Referenced by distributeFunctionTypeAttrToInnermost(), and processTypeAttrs().

◆ HandleHLSLParamModifierAttr()

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

Definition at line 8497 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleLifetimeBoundAttr()

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

Definition at line 8487 of file SemaType.cpp.

References State.

Referenced by processTypeAttrs().

◆ HandleMatrixTypeAttr()

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

HandleMatrixTypeAttr - "matrix_type" attribute, like ext_vector_type.

Definition at line 8439 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ handleMSPointerTypeQualifierAttr()

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

Definition at line 7099 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleNeonVectorTypeAttr()

static 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 8161 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ handleObjCGCTypeAttr()

static 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 6875 of file SemaType.cpp.

Referenced by handleObjCPointerTypeAttr().

◆ handleObjCOwnershipTypeAttr()

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

handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type.

Returns 'true' if the attribute was handled.

Definition at line 6688 of file SemaType.cpp.

References clang::Declarator::getNumTypeObjects(), clang::Type::getPointeeType(), clang::Type::isObjCRetainableType(), clang::Type::isPointerType(), maybeMovePastReturnType(), and clang::ast_matchers::type.

Referenced by handleObjCPointerTypeAttr().

◆ handleObjCPointerTypeAttr()

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

◆ HandleOpenCLAccessAttr()

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

Handle OpenCL Access Qualifier Attribute.

Definition at line 8383 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleRISCVRVVVectorBitsTypeAttr()

static void HandleRISCVRVVVectorBitsTypeAttr ( QualType CurType,
ParsedAttr Attr,
Sema S 
)
static

HandleRISCVRVVVectorBitsTypeAttr - The "riscv_rvv_vector_bits" attribute is used to create fixed-length versions of sizeless RVV types such as vint8m1_t_t.

Definition at line 8313 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleSYCLPipeAttribute()

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

Definition at line 6624 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleVectorSizeAttr()

static 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 8055 of file SemaType.cpp.

Referenced by processTypeAttrs().

◆ HandleWebAssemblyFuncrefAttr()

static bool HandleWebAssemblyFuncrefAttr ( TypeProcessingState &  State,
QualType QT,
ParsedAttr PAttr 
)
static

Definition at line 7196 of file SemaType.cpp.

References clang::ParsedAttr::getKind().

Referenced by processTypeAttrs().

◆ hasNullabilityAttr()

static bool hasNullabilityAttr ( const ParsedAttributesView attrs)
static

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

Definition at line 3867 of file SemaType.cpp.

Referenced by distributeNullabilityTypeAttr().

◆ hasOuterPointerLikeChunk()

static 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 4222 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 processTypeAttrs().

◆ inferARCLifetimeForPointee()

static QualType inferARCLifetimeForPointee ( Sema S,
QualType  type,
SourceLocation  loc,
bool  isReference 
)
static

Given that we're building a pointer or reference to the given.

Definition at line 1662 of file SemaType.cpp.

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

◆ inferARCWriteback()

static void inferARCWriteback ( TypeProcessingState &  state,
QualType declSpecType 
)
static

Given that this is the declaration of a parameter under ARC, attempt to infer attributes and such for pointer-to-whatever types.

Definition at line 2844 of file SemaType.cpp.

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

◆ InventTemplateParameter()

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

Definition at line 3062 of file SemaType.cpp.

Referenced by GetDeclSpecTypeForDeclarator().

◆ isDependentOrGNUAutoType()

static bool isDependentOrGNUAutoType ( QualType  T)
static

◆ IsNoDerefableChunk()

static bool IsNoDerefableChunk ( const DeclaratorChunk Chunk)
static

◆ isOmittedBlockReturnType()

static 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.

◆ isPermittedNeonBaseType()

static bool isPermittedNeonBaseType ( QualType Ty,
VectorKind  VecKind,
Sema S 
)
static

Definition at line 8090 of file SemaType.cpp.

◆ mapNullabilityAttrKind()

static NullabilityKind mapNullabilityAttrKind ( ParsedAttr::Kind  kind)
static

Map a nullability attribute kind to a nullability kind.

Definition at line 7247 of file SemaType.cpp.

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

Referenced by CheckNullabilityTypeSpecifier(), and distributeNullabilityTypeAttr().

◆ maybeMovePastReturnType()

static 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 419 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()

static void maybeSynthesizeBlockSignature ( TypeProcessingState &  state,
QualType  declSpecType 
)
static

◆ moveAttrFromListToList()

static void moveAttrFromListToList ( ParsedAttr attr,
ParsedAttributesView fromList,
ParsedAttributesView toList 
)
static

◆ processTypeAttrs()

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

◆ rebuildAttributedTypeWithoutNullability()

static QualType rebuildAttributedTypeWithoutNullability ( ASTContext Ctx,
QualType  Type 
)
static

Rebuild an attributed type without the nullability attribute on it.

Definition at line 7228 of file SemaType.cpp.

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

◆ recordNullabilitySeen()

static 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 4193 of file SemaType.cpp.

◆ shouldHaveNullability()

static bool shouldHaveNullability ( QualType  T)
static

◆ transferARCOwnership()

static void transferARCOwnership ( TypeProcessingState &  state,
QualType declSpecTy,
Qualifiers::ObjCLifetime  ownership 
)
static

Used for transferring ownership in casts resulting in l-values.

Definition at line 5766 of file SemaType.cpp.

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

◆ transferARCOwnershipToDeclaratorChunk()

static void transferARCOwnershipToDeclaratorChunk ( TypeProcessingState &  state,
Qualifiers::ObjCLifetime  ownership,
unsigned  chunkIndex 
)
static

Definition at line 5729 of file SemaType.cpp.

◆ transferARCOwnershipToDeclSpec()

static void transferARCOwnershipToDeclSpec ( Sema S,
QualType declSpecTy,
Qualifiers::ObjCLifetime  ownership 
)
static

Definition at line 5718 of file SemaType.cpp.

◆ TSTToUnaryTransformType()

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

Definition at line 867 of file SemaType.cpp.

◆ verifyValidIntegerConstantExpr()

static bool verifyValidIntegerConstantExpr ( Sema S,
const ParsedAttr Attr,
llvm::APSInt Result 
)
static

Definition at line 8138 of file SemaType.cpp.

◆ warnAboutAmbiguousFunction()

static 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 3517 of file SemaType.cpp.

◆ warnAboutRedundantParens()

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

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

Definition at line 3614 of file SemaType.cpp.