clang 24.0.0git
clang::CodeGenUtils Namespace Reference

Classes

struct  EHPersonality
 The exceptions personality for a function. More...

Enumerations

enum  PointerTypeInfoFlags {
  PTI_Const = 0x1 , PTI_Volatile = 0x2 , PTI_Restrict = 0x4 , PTI_Incomplete = 0x8 ,
  PTI_ContainingClassIncomplete = 0x10 , PTI_Noexcept = 0x40
}
 Flags for abi::__pbase_type_info. More...
enum  VMIClassTypeInfoFlags { VMI_NonDiamondRepeat = 0x1 , VMI_DiamondShaped = 0x2 }
 Flags for abi::__vmi_class_type_info. More...
enum  BaseClassTypeInfoFlags { BCTI_Virtual = 0x1 , BCTI_Public = 0x2 }
 Flags for abi::__base_class_type_info. More...
enum class  ArmSMEInlinability : uint8_t {
  Ok = 0 , ErrorCalleeRequiresNewZA = 1 << 0 , ErrorCalleeRequiresNewZT0 = 1 << 1 , WarnIncompatibleStreamingModes = 1 << 2 ,
  ErrorIncompatibleStreamingModes = 1 << 3 , IncompatibleStreamingModes , LLVM_MARK_AS_BITMASK_ENUM =(ErrorIncompatibleStreamingModes)
}
 The Arm SME ABI issues that can prevent inlining one function into another. More...

Functions

CanQual< FunctionProtoType > getFormalType (const CXXMethodDecl *MD)
 Returns the canonical formal type of the given C++ method.
llvm::FPClassTest getNoFPClassTestMask (const LangOptions &LangOpts)
 Returns the set of floating-point value kinds that the language options promise never reach a function's arguments or return value.
bool baseInitializerUsesThis (ASTContext &Ctx, const Expr *Init)
 Check whether Init uses 'this' in a way which requires the vtable to be properly set.
bool canSkipVTablePointerInitialization (ASTContext &Ctx, const CXXDestructorDecl *Dtor)
 Check whether we need to initialize any vtable pointers before calling this destructor.
bool fieldHasTrivialDestructorBody (ASTContext &Ctx, const FieldDecl *Field)
 Check whether destructing Field has no observable behaviors, and thus can be skipped when creating a destructor body.
bool isInitializerOfDynamicClass (const CXXCtorInitializer *BaseInit)
 Return whether BaseInit initializes a base class that is dynamic, that is, one whose vtable pointer must be set before the initializer runs.
const EHPersonality & getEHPersonality (const TargetInfo &Target, const LangOptions &LangOpts, const CodeGenOptions &CGOpts, const FunctionDecl *FD)
 Selects the personality function to use for FD, or for the translation unit as a whole when FD is null.
const EHPersonality & getCXXEHPersonality (const TargetInfo &Target, const CodeGenOptions &CGOpts)
 Selects the personality function that plain C++ would use.
QualType getFixedSizeElementType (const ASTContext &Ctx, const VariableArrayType *VLA)
 Strip off the variably-modified array types wrapping VLA and return the first element type that has a fixed size.
bool isBlockVarRef (const Expr *E)
 Check whether the value of E is possibly a reference to or into a __block variable.
bool isCheapEnoughToEvaluateUnconditionally (const Expr *E, const ASTContext &Ctx)
 Check whether E is cheap enough and side-effect-free enough to evaluate unconditionally instead of conditionally.
bool isTrivialFiller (const Expr *E)
 Check whether E is a trivial array filler, that is, one that is equivalent to zero-initialization.
bool onlyHasInlineBuiltinDeclaration (const FunctionDecl *FD)
 Detect the unusual situation where an inline version of a builtin is shadowed by a non-inline version.
bool shouldEmitLifetimeMarkers (const CodeGenOptions &CGOpts, const LangOptions &LangOpts)
 Decide whether we need to emit the lifetime markers.
void checkTargetFeatures (ASTContext &Ctx, DiagnosticsEngine &Diags, const LangOptions &LangOpts, const CallExpr *E, const FunctionDecl *Caller, const FunctionDecl *TargetDecl)
 Check that a call to a target-specific builtin has the required target features enabled in the caller, emitting an error diagnostic if not.
void checkTargetFeatures (ASTContext &Ctx, DiagnosticsEngine &Diags, const LangOptions &LangOpts, SourceLocation Loc, const FunctionDecl *Caller, const FunctionDecl *TargetDecl)
 Overload taking a raw source location instead of a CallExpr.
bool canUseSingleInheritance (const CXXRecordDecl *RD)
 Return whether the given record decl has a "single, public, non-virtual base at offset zero (i.e.
CharUnits computeOffsetHint (ASTContext &Ctx, const CXXRecordDecl *Src, const CXXRecordDecl *Dst)
 Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7].
unsigned computeVMIClassTypeInfoFlags (const CXXRecordDecl *RD)
 Compute the value of the flags member in abi::__vmi_class_type_info.
bool containsIncompleteClassType (QualType Ty)
 Returns whether the given type contains an incomplete class type.
unsigned extractPBaseFlags (const ASTContext &Ctx, QualType &Type)
 Compute the flags for a __pbase_type_info, and remove the corresponding pieces from Type.
bool isStandardLibraryRTTIDescriptor (QualType Ty)
 Returns whether the type information for the given type exists in the standard library.
LangAS getGlobalConstantAddressSpace (const LangOptions &LangOpts, const TargetInfo &Target)
 Determines whether the language options require us to model unwind exceptions.
bool hasUnwindExceptions (const LangOptions &LangOpts)
bool isVarDeclStrongDefinition (const ASTContext &Ctx, const VarDecl *D, bool NoCommon)
 Check whether D is a strong definition, and thus must not be given common linkage.
bool shouldBeInCOMDAT (const ASTContext &Ctx, const Decl &D)
 Check whether D should be emitted into a COMDAT group.
bool hasOwnStorage (const ASTContext &Ctx, const CXXRecordDecl *Decl, const CXXRecordDecl *Query)
 Recursively searches all of the bases of Decl to find out whether Query is not the primary vbase of some base class.
bool isDiscreteBitFieldABI (const ASTContext &Ctx, const RecordDecl *RD)
 The Microsoft bitfield layout rule allocates discrete storage units of the field's formal type and only combines adjacent fields of the same formal type.
bool isEmptyFieldForLayout (const ASTContext &Ctx, const FieldDecl *FD)
 Return true iff the field is "empty", that is, either a zero-width bit-field or an isEmptyRecordForLayout.
bool isEmptyRecordForLayout (const ASTContext &Ctx, QualType T)
 Return true iff a structure contains only empty base classes (per isEmptyRecordForLayout) and fields (per isEmptyFieldForLayout).
bool isOverlappingVBaseABI (const ASTContext &Ctx)
 The Itanium base layout rule allows virtual bases to overlap other bases, which complicates layout in specific ways.
template<typename LoopStmt>
bool hasEmptyLoopBody (const LoopStmt &S)
bool checkIfLoopMustProgress (const LangOptions &LangOpts, const CodeGenOptions &CGOpts, ASTContext &Ctx, const Expr *ControllingExpression, bool HasEmptyBody, llvm::function_ref< void()> RemoveMustProgress)
 Returns true if a loop must make progress, which means the mustprogress attribute can be added to it.
ArmSMEInlinability getArmSMEInlinability (const FunctionDecl *Caller, const FunctionDecl *Callee)
 Determines if there are any Arm SME ABI issues with inlining Callee into Caller.
bool hasExtraNeonArgument (unsigned BuiltinID)
 Returns whether the Neon builtin BuiltinID takes a trailing argument that discriminates the operand type.
bool isAAPCS (const TargetInfo &TargetInfo)
 Helper method to check if the underlying ABI is AAPCS.
bool requiresAMDGPUProtectedVisibility (const Decl *D, bool HasHiddenVisibility)
 Returns whether D must be given protected visibility on AMDGPU.
bool spirNullPointerNeedsGenericCast (QualType QT, const llvm::Triple &Triple)
 Return true if a SPIR(-V) null pointer of type QT must be materialized as an addrspacecast from a generic null pointer, as the null bit pattern in non-generic address spaces is unspecified.
static bool hasTrivialDestructorBody (ASTContext &Ctx, const CXXRecordDecl *BaseClassDecl, const CXXRecordDecl *MostDerivedClassDecl)
static const EHPersonality & getCPersonality (const TargetInfo &Target, const CodeGenOptions &CGOpts)
static const EHPersonality & getObjCPersonality (const TargetInfo &Target, const CodeGenOptions &CGOpts, const LangOptions &L)
static const EHPersonality & getObjCXXPersonality (const TargetInfo &Target, const CodeGenOptions &CGOpts, const LangOptions &L)
 Determines the personality function to use when both C++ and Objective-C exceptions are being caught.
static const EHPersonality & getSEHPersonalityMSVC (const llvm::Triple &T)
static unsigned computeVMIClassTypeInfoFlags (const CXXBaseSpecifier *Base, SeenBases &Bases)
static bool isIncompleteClassType (const RecordType *RecordTy)
 Returns whether the given record type is incomplete.
static bool typeInfoIsInStandardLibrary (const BuiltinType *Ty)
 Given a builtin type, returns whether the type info for that type is defined in the standard library.
static bool typeInfoIsInStandardLibrary (const PointerType *PointerTy)
static bool isStreamingCompatible (const FunctionDecl *F)

Enumeration Type Documentation

◆ ArmSMEInlinability

The Arm SME ABI issues that can prevent inlining one function into another.

Enumerator
Ok 
ErrorCalleeRequiresNewZA 
ErrorCalleeRequiresNewZT0 
WarnIncompatibleStreamingModes 
ErrorIncompatibleStreamingModes 
IncompatibleStreamingModes 
LLVM_MARK_AS_BITMASK_ENUM 

Definition at line 39 of file TargetUtils.h.

◆ BaseClassTypeInfoFlags

Flags for abi::__base_class_type_info.

Enumerator
BCTI_Virtual 

BCTI_Virtual - Base class is virtual.

BCTI_Public 

BCTI_Public - Base class is public.

Definition at line 57 of file ItaniumCXXABIUtils.h.

◆ PointerTypeInfoFlags

Flags for abi::__pbase_type_info.

Enumerator
PTI_Const 

PTI_Const - Type has const qualifier.

PTI_Volatile 

PTI_Volatile - Type has volatile qualifier.

PTI_Restrict 

PTI_Restrict - Type has restrict qualifier.

PTI_Incomplete 

PTI_Incomplete - Type is incomplete.

PTI_ContainingClassIncomplete 

PTI_ContainingClassIncomplete - Containing class is incomplete.

(in pointer to member).

PTI_Noexcept 

PTI_TransactionSafe - Pointee is transaction_safe function (C++ TM TS).

PTI_Noexcept - Pointee is noexcept function (C++1z).

Definition at line 23 of file ItaniumCXXABIUtils.h.

◆ VMIClassTypeInfoFlags

Flags for abi::__vmi_class_type_info.

Enumerator
VMI_NonDiamondRepeat 

VMI_NonDiamondRepeat - Class has non-diamond repeated inheritance.

VMI_DiamondShaped 

VMI_DiamondShaped - Class is diamond shaped.

Definition at line 48 of file ItaniumCXXABIUtils.h.

Function Documentation

◆ baseInitializerUsesThis()

bool clang::CodeGenUtils::baseInitializerUsesThis ( ASTContext & Ctx,
const Expr * Init )

Check whether Init uses 'this' in a way which requires the vtable to be properly set.

Definition at line 33 of file ClassUtils.cpp.

References clang::Init.

Referenced by EmitBaseInitializer(), and clang::CIRGen::CIRGenFunction::emitBaseInitializer().

◆ canSkipVTablePointerInitialization()

bool clang::CodeGenUtils::canSkipVTablePointerInitialization ( ASTContext & Ctx,
const CXXDestructorDecl * Dtor )

◆ canUseSingleInheritance()

bool clang::CodeGenUtils::canUseSingleInheritance ( const CXXRecordDecl * RD)

Return whether the given record decl has a "single, public, non-virtual base at offset zero (i.e.

the derived class is dynamic iff the base is)", according to Itanium C++ ABI, 2.95p6b.

Definition at line 64 of file ItaniumCXXABIUtils.cpp.

References clang::AS_public, clang::CXXRecordDecl::bases_begin(), clang::CXXRecordDecl::getNumBases(), and clang::CXXRecordDecl::isDynamicClass().

◆ checkIfLoopMustProgress()

bool clang::CodeGenUtils::checkIfLoopMustProgress ( const LangOptions & LangOpts,
const CodeGenOptions & CGOpts,
ASTContext & Ctx,
const Expr * ControllingExpression,
bool HasEmptyBody,
llvm::function_ref< void()> RemoveMustProgress )

Returns true if a loop must make progress, which means the mustprogress attribute can be added to it.

HasEmptyBody indicates whether the loop is trivially empty (see hasEmptyLoopBody()).

A loop that is both trivially empty and has a constant-true controlling expression (e.g. while (true) {}) is a trivial infinite loop, which is exempt from the forward-progress guarantee: [C++26][stmt.iter.general] (DR). When such a loop is found, RemoveMustProgress is called so the caller can delete the 'mustprogress' attribute it may have speculatively added to the enclosing function.

Definition at line 15 of file StmtUtils.cpp.

References clang::CodeGenOptions::Always, clang::Expr::EvaluateAsInt(), clang::CodeGenOptions::Never, and clang::Result.

Referenced by clang::CIRGen::CIRGenFunction::checkIfLoopMustProgress(), and clang::CodeGen::CodeGenFunction::checkIfLoopMustProgress().

◆ checkTargetFeatures() [1/2]

void clang::CodeGenUtils::checkTargetFeatures ( ASTContext & Ctx,
DiagnosticsEngine & Diags,
const LangOptions & LangOpts,
const CallExpr * E,
const FunctionDecl * Caller,
const FunctionDecl * TargetDecl )

◆ checkTargetFeatures() [2/2]

◆ computeOffsetHint()

CharUnits clang::CodeGenUtils::computeOffsetHint ( ASTContext & Ctx,
const CXXRecordDecl * Src,
const CXXRecordDecl * Dst )

Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7].

Definition at line 15 of file ItaniumCXXABIUtils.cpp.

References clang::AS_public, clang::CharUnits::fromQuantity(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), and clang::CXXRecordDecl::isDerivedFrom().

Referenced by emitDynamicCastInfo().

◆ computeVMIClassTypeInfoFlags() [1/2]

unsigned clang::CodeGenUtils::computeVMIClassTypeInfoFlags ( const CXXBaseSpecifier * Base,
SeenBases & Bases )
static

◆ computeVMIClassTypeInfoFlags() [2/2]

unsigned clang::CodeGenUtils::computeVMIClassTypeInfoFlags ( const CXXRecordDecl * RD)

Compute the value of the flags member in abi::__vmi_class_type_info.

Definition at line 129 of file ItaniumCXXABIUtils.cpp.

References clang::CXXRecordDecl::bases(), and computeVMIClassTypeInfoFlags().

Referenced by computeVMIClassTypeInfoFlags(), and computeVMIClassTypeInfoFlags().

◆ containsIncompleteClassType()

bool clang::CodeGenUtils::containsIncompleteClassType ( QualType Ty)

Returns whether the given type contains an incomplete class type.

This is true if

  • The given type is an incomplete class type.
  • The given type is a pointer type whose pointee type contains an incomplete class type.
  • The given type is a member pointer type whose class is an incomplete class type.
  • The given type is a member pointer type whose pointee type contains an incomplete class type.

Definition at line 145 of file ItaniumCXXABIUtils.cpp.

References containsIncompleteClassType(), and isIncompleteClassType().

Referenced by containsIncompleteClassType(), extractPBaseFlags(), getTypeInfoLinkage(), and getTypeInfoLinkage().

◆ extractPBaseFlags()

unsigned clang::CodeGenUtils::extractPBaseFlags ( const ASTContext & Ctx,
QualType & Type )

Compute the flags for a __pbase_type_info, and remove the corresponding pieces from Type.

Definition at line 165 of file ItaniumCXXABIUtils.cpp.

References containsIncompleteClassType(), clang::EST_None, clang::Type::getAs(), clang::ASTContext::getFunctionTypeWithExceptionSpec(), PTI_Const, PTI_Incomplete, PTI_Noexcept, PTI_Restrict, and PTI_Volatile.

◆ fieldHasTrivialDestructorBody()

bool clang::CodeGenUtils::fieldHasTrivialDestructorBody ( ASTContext & Ctx,
const FieldDecl * Field )

Check whether destructing Field has no observable behaviors, and thus can be skipped when creating a destructor body.

So non-record types, anonymous structs/unions, or record types where the destructor doesnt DO anything are considered as this version of 'trivial'. Note: This is a more liberal definition of trivial destruction than the C++ Standard's version, and thus cannot be used as a substitute for C++ Standard requirements.

Definition at line 76 of file ClassUtils.cpp.

References clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getBaseElementType(), and hasTrivialDestructorBody().

Referenced by canSkipVTablePointerInitialization(), and hasTrivialDestructorBody().

◆ getArmSMEInlinability()

ArmSMEInlinability clang::CodeGenUtils::getArmSMEInlinability ( const FunctionDecl * Caller,
const FunctionDecl * Callee )

Determines if there are any Arm SME ABI issues with inlining Callee into Caller.

Returns the issue (if any) in the ArmSMEInlinability bit enum.

Definition at line 31 of file TargetUtils.cpp.

References ErrorCalleeRequiresNewZA, ErrorCalleeRequiresNewZT0, ErrorIncompatibleStreamingModes, clang::IsArmStreamingFunction(), isStreamingCompatible(), Ok, and WarnIncompatibleStreamingModes.

◆ getCPersonality()

◆ getCXXEHPersonality()

◆ getEHPersonality()

const EHPersonality & clang::CodeGenUtils::getEHPersonality ( const TargetInfo & Target,
const LangOptions & LangOpts,
const CodeGenOptions & CGOpts,
const FunctionDecl * FD )

Selects the personality function to use for FD, or for the translation unit as a whole when FD is null.

Definition at line 165 of file EHPersonality.cpp.

References getCPersonality(), getCXXEHPersonality(), getObjCPersonality(), getObjCXXPersonality(), getSEHPersonalityMSVC(), clang::Target, and clang::FunctionDecl::usesSEHTry().

Referenced by clang::CIRGen::getEHPersonality(), and clang::CodeGen::getEHPersonality().

◆ getFixedSizeElementType()

QualType clang::CodeGenUtils::getFixedSizeElementType ( const ASTContext & Ctx,
const VariableArrayType * VLA )

Strip off the variably-modified array types wrapping VLA and return the first element type that has a fixed size.

Definition at line 15 of file ExprUtils.cpp.

References clang::ASTContext::getAsVariableArrayType(), and clang::ArrayType::getElementType().

Referenced by emitArraySubscriptGEP(), and emitArraySubscriptPtr().

◆ getFormalType()

◆ getGlobalConstantAddressSpace()

LangAS clang::CodeGenUtils::getGlobalConstantAddressSpace ( const LangOptions & LangOpts,
const TargetInfo & Target )

Determines whether the language options require us to model unwind exceptions.

We treat -fexceptions as mandating this except under the fragile ObjC ABI with only ObjC exceptions enabled. This means, for example, that C with -fexceptions enables this. Return the AST address space of constant literal, which is used to emit the constant literal as global variable in LLVM IR. Note: This is not necessarily the address space of the constant literal in AST. For address space agnostic language, e.g. C++, constant literal in AST is always in default address space.

Definition at line 15 of file ModuleUtils.cpp.

References clang::cuda_device, clang::Default, clang::opencl_constant, clang::sycl_global, and clang::Target.

Referenced by generateStringLiteral(), and clang::CodeGen::CodeGenModule::GetGlobalConstantAddressSpace().

◆ getNoFPClassTestMask()

llvm::FPClassTest clang::CodeGenUtils::getNoFPClassTestMask ( const LangOptions & LangOpts)

Returns the set of floating-point value kinds that the language options promise never reach a function's arguments or return value.

Definition at line 19 of file CallUtils.cpp.

Referenced by clang::CodeGen::CodeGenModule::ConstructAttributeList().

◆ getObjCPersonality()

◆ getObjCXXPersonality()

◆ getSEHPersonalityMSVC()

const EHPersonality & clang::CodeGenUtils::getSEHPersonalityMSVC ( const llvm::Triple & T)
static

◆ hasEmptyLoopBody()

◆ hasExtraNeonArgument()

bool clang::CodeGenUtils::hasExtraNeonArgument ( unsigned BuiltinID)

Returns whether the Neon builtin BuiltinID takes a trailing argument that discriminates the operand type.

This should be kept consistent with the logic in Sema. TODO: Make this return false for SISD builtins.

Definition at line 59 of file TargetUtils.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr(), clang::CIRGen::CIRGenFunction::emitAArch64BuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr().

◆ hasOwnStorage()

bool clang::CodeGenUtils::hasOwnStorage ( const ASTContext & Ctx,
const CXXRecordDecl * Decl,
const CXXRecordDecl * Query )

Recursively searches all of the bases of Decl to find out whether Query is not the primary vbase of some base class.

Definition at line 15 of file RecordLayoutUtils.cpp.

References clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getPrimaryBase(), hasOwnStorage(), and clang::ASTRecordLayout::isPrimaryBaseVirtual().

Referenced by hasOwnStorage().

◆ hasTrivialDestructorBody()

◆ hasUnwindExceptions()

◆ isAAPCS()

◆ isBlockVarRef()

bool clang::CodeGenUtils::isBlockVarRef ( const Expr * E)

Check whether the value of E is possibly a reference to or into a __block variable.

Definition at line 24 of file ExprUtils.cpp.

References clang::Decl::hasAttr(), clang::Expr::IgnoreParens(), and isBlockVarRef().

Referenced by isBlockVarRef().

◆ isCheapEnoughToEvaluateUnconditionally()

bool clang::CodeGenUtils::isCheapEnoughToEvaluateUnconditionally ( const Expr * E,
const ASTContext & Ctx )

Check whether E is cheap enough and side-effect-free enough to evaluate unconditionally instead of conditionally.

This is used to convert control flow into selects in some cases.

Definition at line 87 of file ExprUtils.cpp.

References clang::Expr::IgnoreParens(), and clang::Expr::isEvaluatable().

◆ isDiscreteBitFieldABI()

bool clang::CodeGenUtils::isDiscreteBitFieldABI ( const ASTContext & Ctx,
const RecordDecl * RD )

The Microsoft bitfield layout rule allocates discrete storage units of the field's formal type and only combines adjacent fields of the same formal type.

We want to emit a layout with these discrete storage units instead of combining them into a continuous run.

Definition at line 26 of file RecordLayoutUtils.cpp.

References clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), clang::TargetCXXABI::isMicrosoft(), and clang::RecordDecl::isMsStruct().

◆ isEmptyFieldForLayout()

◆ isEmptyRecordForLayout()

bool clang::CodeGenUtils::isEmptyRecordForLayout ( const ASTContext & Ctx,
QualType T )

Return true iff a structure contains only empty base classes (per isEmptyRecordForLayout) and fields (per isEmptyFieldForLayout).

Note, C++ record fields are considered empty if the [[no_unique_address]] attribute would have made them empty, so this is not the same as isEmptyRecord.

Definition at line 40 of file RecordLayoutUtils.cpp.

References isEmptyFieldForLayout(), isEmptyRecordForLayout(), and clang::T.

Referenced by EmitNullConstant(), emitNullConstant(), isEmptyFieldForLayout(), and isEmptyRecordForLayout().

◆ isIncompleteClassType()

bool clang::CodeGenUtils::isIncompleteClassType ( const RecordType * RecordTy)
static

Returns whether the given record type is incomplete.

Definition at line 141 of file ItaniumCXXABIUtils.cpp.

Referenced by containsIncompleteClassType().

◆ isInitializerOfDynamicClass()

bool clang::CodeGenUtils::isInitializerOfDynamicClass ( const CXXCtorInitializer * BaseInit)

Return whether BaseInit initializes a base class that is dynamic, that is, one whose vtable pointer must be set before the initializer runs.

Definition at line 112 of file ClassUtils.cpp.

References clang::Type::castAsCXXRecordDecl(), clang::CXXCtorInitializer::getBaseClass(), and clang::CXXRecordDecl::isDynamicClass().

Referenced by clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), and clang::CIRGen::CIRGenFunction::emitCtorPrologue().

◆ isOverlappingVBaseABI()

bool clang::CodeGenUtils::isOverlappingVBaseABI ( const ASTContext & Ctx)

The Itanium base layout rule allows virtual bases to overlap other bases, which complicates layout in specific ways.

Note specifically that the ms_struct attribute doesn't change this.

Definition at line 62 of file RecordLayoutUtils.cpp.

References clang::TargetInfo::getCXXABI(), clang::ASTContext::getTargetInfo(), and clang::TargetCXXABI::isMicrosoft().

◆ isStandardLibraryRTTIDescriptor()

bool clang::CodeGenUtils::isStandardLibraryRTTIDescriptor ( QualType Ty)

Returns whether the type information for the given type exists in the standard library.

Definition at line 327 of file ItaniumCXXABIUtils.cpp.

References typeInfoIsInStandardLibrary().

◆ isStreamingCompatible()

bool clang::CodeGenUtils::isStreamingCompatible ( const FunctionDecl * F)
static

◆ isTrivialFiller()

bool clang::CodeGenUtils::isTrivialFiller ( const Expr * E)

Check whether E is a trivial array filler, that is, one that is equivalent to zero-initialization.

Definition at line 100 of file ExprUtils.cpp.

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

Referenced by isTrivialFiller().

◆ isVarDeclStrongDefinition()

◆ onlyHasInlineBuiltinDeclaration()

bool clang::CodeGenUtils::onlyHasInlineBuiltinDeclaration ( const FunctionDecl * FD)

Detect the unusual situation where an inline version of a builtin is shadowed by a non-inline version.

In that case we should pick the external one everywhere. That's GCC behavior too.

Definition at line 121 of file ExprUtils.cpp.

References clang::FunctionDecl::getPreviousDecl().

Referenced by EmitDirectCallee().

◆ requiresAMDGPUProtectedVisibility()

bool clang::CodeGenUtils::requiresAMDGPUProtectedVisibility ( const Decl * D,
bool HasHiddenVisibility )

Returns whether D must be given protected visibility on AMDGPU.

HasHiddenVisibility is whether the emitted global currently has hidden visibility.

Definition at line 91 of file TargetUtils.cpp.

References clang::cast(), clang::Decl::hasAttr(), and clang::isa().

◆ shouldBeInCOMDAT()

◆ shouldEmitLifetimeMarkers()

bool clang::CodeGenUtils::shouldEmitLifetimeMarkers ( const CodeGenOptions & CGOpts,
const LangOptions & LangOpts )

Decide whether we need to emit the lifetime markers.

Definition at line 21 of file FunctionUtils.cpp.

References clang::SanitizerSet::has(), and clang::LangOptions::Sanitize.

Referenced by clang::CIRGen::CIRGenFunction::CIRGenFunction().

◆ spirNullPointerNeedsGenericCast()

bool clang::CodeGenUtils::spirNullPointerNeedsGenericCast ( QualType QT,
const llvm::Triple & Triple )

Return true if a SPIR(-V) null pointer of type QT must be materialized as an addrspacecast from a generic null pointer, as the null bit pattern in non-generic address spaces is unspecified.

Definition at line 109 of file TargetUtils.cpp.

References clang::Default, clang::QualType::getAddressSpace(), clang::Type::getPointeeType(), clang::Type::getUnqualifiedDesugaredType(), clang::Type::isNullPtrType(), clang::isTargetAddressSpace(), clang::opencl_constant, clang::opencl_generic, and clang::toTargetAddressSpace().

◆ typeInfoIsInStandardLibrary() [1/2]

bool clang::CodeGenUtils::typeInfoIsInStandardLibrary ( const BuiltinType * Ty)
static

Given a builtin type, returns whether the type info for that type is defined in the standard library.

Definition at line 194 of file ItaniumCXXABIUtils.cpp.

References clang::BuiltinType::getKind().

Referenced by isStandardLibraryRTTIDescriptor(), and typeInfoIsInStandardLibrary().

◆ typeInfoIsInStandardLibrary() [2/2]

bool clang::CodeGenUtils::typeInfoIsInStandardLibrary ( const PointerType * PointerTy)
static