clang 24.0.0git
CGExpr.cpp File Reference
#include "ABIInfoImpl.h"
#include "CGCUDARuntime.h"
#include "CGCXXABI.h"
#include "CGCall.h"
#include "CGCleanup.h"
#include "CGDebugInfo.h"
#include "CGHLSLRuntime.h"
#include "CGObjCRuntime.h"
#include "CGOpenMPRuntime.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "CodeGenPGO.h"
#include "ConstantEmitter.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/InferAlloc.h"
#include "clang/AST/MatrixUtils.h"
#include "clang/AST/NSAPI.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "clang/CodeGenUtils/CodeGenUtils.h"
#include "clang/CodeGenUtils/ExprUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/MatrixBuilder.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/xxhash.h"
#include "llvm/Transforms/Utils/SanitizerStats.h"
#include <numeric>
#include <optional>
#include <string>

Go to the source code of this file.

Namespaces

namespace  clang
 Top level wrappers for InstallAPI frontend operations.

Macros

#define SANITIZER_CHECK(Enum, Name, Version, Msg)
#define SANITIZER_CHECK(Enum, Name, Version, Msg)

Typedefs

using RecIndicesTy = SmallVector<llvm::Value *, 8>

Enumerations

enum  VariableTypeDescriptorKind : uint16_t { TK_Integer = 0x0000 , TK_Float = 0x0001 , TK_BitInt = 0x0002 , TK_Unknown = 0xffff }
enum  ConstantEmissionKind { CEK_None , CEK_AsReferenceOnly , CEK_AsValueOrReference , CEK_AsValueOnly }
 Can we constant-emit a load of a reference to a variable of the given type? More...

Functions

llvm::cl::opt< boolclang::ClSanitizeGuardChecks ("ubsan-guard-checks", llvm::cl::Optional, llvm::cl::desc("Guard UBSAN checks with `llvm.allow.ubsan.check()`."))
static llvm::StringRef GetUBSanTrapForHandler (SanitizerHandler ID)
static void pushTemporaryCleanup (CodeGenFunction &CGF, const MaterializeTemporaryExpr *M, const Expr *E, Address ReferenceTemporary)
static RawAddress createReferenceTemporary (CodeGenFunction &CGF, const MaterializeTemporaryExpr *M, const Expr *Inner, RawAddress *Alloca=nullptr)
static llvm::ValueemitHashMix (CGBuilderTy &Builder, llvm::Value *Acc, llvm::Value *Ptr)
static llvm::ValuegetArrayIndexingBound (CodeGenFunction &CGF, const Expr *Base, QualType &IndexedType, LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel)
 If Base is known to point to the start of an array, return the length of that array.
static bool RecordContainsField (const RecordDecl *RD, const FieldDecl *Field)
 Returns true if Field is reachable from RD either as a direct field or through a chain of nested record fields (including anonymous structs/unions).
static bool getGEPIndicesToField (CodeGenFunction &CGF, const RecordDecl *RD, const FieldDecl *Field, RecIndicesTy &Indices)
static CharUnits getArrayElementAlign (CharUnits arrayAlign, llvm::Value *idx, CharUnits eltSize)
static Address emitPointerArithmetic (CodeGenFunction &CGF, const BinaryOperator *BO, LValueBaseInfo *BaseInfo, TBAAAccessInfo *TBAAInfo, KnownNonNull_t IsKnownNonNull)
 Emit pointer + index arithmetic.
static Address EmitPointerWithAlignment (const Expr *E, LValueBaseInfo *BaseInfo, TBAAAccessInfo *TBAAInfo, KnownNonNull_t IsKnownNonNull, CodeGenFunction &CGF)
static bool isConstantEmittableObjectType (QualType type)
 Given an object of the given canonical type, can we safely copy a value out of it based on its initializer?
static ConstantEmissionKind checkVarTypeForConstantEmission (QualType type)
static DeclRefExprtryToConvertMemberExprToDeclRefExpr (CodeGenFunction &CGF, const MemberExpr *ME)
static bool getRangeForType (CodeGenFunction &CGF, QualType Ty, llvm::APInt &Min, llvm::APInt &End, bool StrictEnums, bool StrictBool, bool IsBool)
static RawAddress MaybeConvertMatrixAddress (RawAddress Addr, CodeGenFunction &CGF, bool IsVector=true)
static void EmitStoreOfMatrixScalar (llvm::Value *value, LValue lvalue, bool isInit, CodeGenFunction &CGF)
static RValue EmitLoadOfMatrixLValue (LValue LV, SourceLocation Loc, CodeGenFunction &CGF)
static void setObjCGCLValueClass (const ASTContext &Ctx, const Expr *E, LValue &LV, bool IsMemberAccess=false)
static LValue EmitThreadPrivateVarDeclLValue (CodeGenFunction &CGF, const VarDecl *VD, QualType T, Address Addr, llvm::Type *RealVarTy, SourceLocation Loc)
static Address emitDeclTargetVarDeclLValue (CodeGenFunction &CGF, const VarDecl *VD, QualType T)
static LValue EmitGlobalVarDeclLValue (CodeGenFunction &CGF, const Expr *E, const VarDecl *VD)
static LValue EmitFunctionDeclLValue (CodeGenFunction &CGF, const Expr *E, GlobalDecl GD)
static LValue EmitCapturedFieldLValue (CodeGenFunction &CGF, const FieldDecl *FD, llvm::Value *ThisValue)
static LValue EmitGlobalNamedRegister (const VarDecl *VD, CodeGenModule &CGM)
 Named Registers are named metadata pointing to the register name which will be read from/written to as an argument to the intrinsic @llvm.read/write_register.
static bool canEmitSpuriousReferenceToVariable (CodeGenFunction &CGF, const DeclRefExpr *E, const VarDecl *VD)
 Determine whether we can emit a reference to VD from the current context, despite not necessarily having seen an odr-use of the variable in this context.
static CheckRecoverableKind getRecoverableKind (SanitizerKind::SanitizerOrdinal Ordinal)
static void emitCheckHandlerCall (CodeGenFunction &CGF, llvm::FunctionType *FnType, ArrayRef< llvm::Value * > FnArgs, SanitizerHandler CheckHandler, CheckRecoverableKind RecoverKind, bool IsFatal, llvm::BasicBlock *ContBB, bool NoMerge)
static const ExprisSimpleArrayDecayOperand (const Expr *E)
 isSimpleArrayDecayOperand - If the specified expr is a simple decay from an array to pointer, return the array subexpression.
static llvm::ValueemitArraySubscriptGEP (CodeGenFunction &CGF, llvm::Type *elemType, llvm::Value *ptr, ArrayRef< llvm::Value * > indices, bool inbounds, bool signedIndices, SourceLocation loc, const llvm::Twine &name="arrayidx")
static Address emitArraySubscriptGEP (CodeGenFunction &CGF, Address addr, ArrayRef< llvm::Value * > indices, llvm::Type *arrayType, llvm::Type *elementType, bool inbounds, bool signedIndices, SourceLocation loc, CharUnits align, const llvm::Twine &name="arrayidx")
static bool hasBPFPreserveStaticOffset (const RecordDecl *D)
static bool hasBPFPreserveStaticOffset (const Expr *E)
static Address wrapWithBPFPreserveStaticOffset (CodeGenFunction &CGF, Address &Addr)
static bool IsPreserveAIArrayBase (CodeGenFunction &CGF, const Expr *ArrayBase)
 Given an array base, check whether its member access belongs to a record with preserve_access_index attribute or not.
static Address emitArraySubscriptGEP (CodeGenFunction &CGF, Address addr, ArrayRef< llvm::Value * > indices, QualType eltType, bool inbounds, bool signedIndices, SourceLocation loc, QualType *arrayType=nullptr, const Expr *Base=nullptr, const llvm::Twine &name="arrayidx")
static bool getFieldOffsetInBits (CodeGenFunction &CGF, const RecordDecl *RD, const FieldDecl *Field, int64_t &Offset)
 The offset of a field from the beginning of the record.
static std::optional< int64_t > getOffsetDifferenceInBits (CodeGenFunction &CGF, const FieldDecl *FD1, const FieldDecl *FD2)
 Returns the relative offset difference between FD1 and FD2.
static llvm::ValueconvertSizedByBoundToElementCount (CodeGenFunction &CGF, llvm::Value *BoundsVal, QualType PointeeTy, bool CountSigned)
 Convert a '__sized_by' byte-count bound to an element-count bound so it can be compared against an element index.
static Address emitOMPArraySectionBase (CodeGenFunction &CGF, const Expr *Base, LValueBaseInfo &BaseInfo, TBAAAccessInfo &TBAAInfo, QualType BaseTy, QualType ElTy, bool IsLowerBound)
static Address emitAddrOfZeroSizeField (CodeGenFunction &CGF, Address Base, const FieldDecl *Field, bool IsInBounds)
 Get the address of a zero-sized field within a record.
static Address emitRawAddrOfFieldStorage (CodeGenFunction &CGF, Address base, const FieldDecl *field, bool IsInBounds)
 Drill down to the storage of a field without walking into reference types, and without respect for pointer field protection.
static Address emitAddrOfFieldStorage (CodeGenFunction &CGF, Address base, const FieldDecl *field, bool IsInBounds)
 Drill down to the storage of a field without walking into reference types, wrapping the address in an llvm.protected.field.ptr intrinsic for the pointer field protection feature if necessary.
static Address emitPreserveStructAccess (CodeGenFunction &CGF, LValue base, Address addr, const FieldDecl *field)
static bool hasAnyVptr (const QualType Type, const ASTContext &Context)
static std::optional< LValue > EmitLValueOrThrowExpression (CodeGenFunction &CGF, const Expr *Operand)
 Emit the operand of a glvalue conditional operator.
static CGCallee EmitDirectCallee (CodeGenFunction &CGF, GlobalDecl GD)
static GlobalDecl getGlobalDeclForDirectCall (const FunctionDecl *FD)
static LValueOrRValue emitPseudoObjectExpr (CodeGenFunction &CGF, const PseudoObjectExpr *E, bool forLValue, AggValueSlot slot)

Variables

const SanitizerHandlerInfo SanitizerHandlers []

Macro Definition Documentation

◆ SANITIZER_CHECK [1/2]

#define SANITIZER_CHECK ( Enum,
Name,
Version,
Msg )
Value:
case SanitizerHandler::Enum: \
return Msg;

◆ SANITIZER_CHECK [2/2]

#define SANITIZER_CHECK ( Enum,
Name,
Version,
Msg )
Value:
{#Name, Version},

Typedef Documentation

◆ RecIndicesTy

Definition at line 1188 of file CGExpr.cpp.

Enumeration Type Documentation

◆ ConstantEmissionKind

Can we constant-emit a load of a reference to a variable of the given type?

This is different from predicates like Decl::mightBeUsableInConstantExpressions because we do want it to apply in situations that don't necessarily satisfy the language's rules for this (e.g. C++'s ODR-use rules). For example, we want to able to do this with const float variables even if those variables aren't marked 'constexpr'.

Enumerator
CEK_None 
CEK_AsReferenceOnly 
CEK_AsValueOrReference 
CEK_AsValueOnly 

Definition at line 1936 of file CGExpr.cpp.

◆ VariableTypeDescriptorKind

Enumerator
TK_Integer 

An integer type.

TK_Float 

A floating-point type.

TK_BitInt 

An _BitInt(N) type.

TK_Unknown 

Any other type. The value representation is unspecified.

Definition at line 82 of file CGExpr.cpp.

Function Documentation

◆ canEmitSpuriousReferenceToVariable()

bool canEmitSpuriousReferenceToVariable ( CodeGenFunction & CGF,
const DeclRefExpr * E,
const VarDecl * VD )
static

◆ checkVarTypeForConstantEmission()

◆ convertSizedByBoundToElementCount()

llvm::Value * convertSizedByBoundToElementCount ( CodeGenFunction & CGF,
llvm::Value * BoundsVal,
QualType PointeeTy,
bool CountSigned )
static

Convert a '__sized_by' byte-count bound to an element-count bound so it can be compared against an element index.

BoundsVal is the loaded byte count and PointeeTy is the pointer's pointee type. Returns BoundsVal unchanged when no scaling is needed, otherwise returns a new llvm::Value* that is element count.

Definition at line 5050 of file CGExpr.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::getContext(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), clang::Type::isFunctionType(), clang::Type::isIncompleteType(), clang::QualType::isNull(), clang::Type::isVoidType(), and clang::CharUnits::One().

Referenced by clang::CodeGen::CodeGenFunction::EmitCountedByBoundsChecking().

◆ createReferenceTemporary()

◆ emitAddrOfFieldStorage()

Address emitAddrOfFieldStorage ( CodeGenFunction & CGF,
Address base,
const FieldDecl * field,
bool IsInBounds )
static

Drill down to the storage of a field without walking into reference types, wrapping the address in an llvm.protected.field.ptr intrinsic for the pointer field protection feature if necessary.

The resulting address doesn't necessarily have the right type.

Definition at line 5920 of file CGExpr.cpp.

References clang::Addr, clang::CodeGen::CodeGenFunction::EmitAddressOfPFPField(), emitRawAddrOfFieldStorage(), clang::CodeGen::CodeGenFunction::getContext(), and clang::ASTContext::isPFPField().

Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField(), and clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization().

◆ emitAddrOfZeroSizeField()

Address emitAddrOfZeroSizeField ( CodeGenFunction & CGF,
Address Base,
const FieldDecl * Field,
bool IsInBounds )
static

◆ emitArraySubscriptGEP() [1/3]

◆ emitArraySubscriptGEP() [2/3]

◆ emitArraySubscriptGEP() [3/3]

◆ EmitCapturedFieldLValue()

LValue EmitCapturedFieldLValue ( CodeGenFunction & CGF,
const FieldDecl * FD,
llvm::Value * ThisValue )
static

◆ emitCheckHandlerCall()

◆ emitDeclTargetVarDeclLValue()

◆ EmitDirectCallee()

◆ EmitFunctionDeclLValue()

◆ EmitGlobalNamedRegister()

LValue EmitGlobalNamedRegister ( const VarDecl * VD,
CodeGenModule & CGM )
static

Named Registers are named metadata pointing to the register name which will be read from/written to as an argument to the intrinsic @llvm.read/write_register.

So far, only the name is being passed down, but other options such as register type, allocation type or even optimization options could be passed down via the metadata node.

Definition at line 3546 of file CGExpr.cpp.

References clang::Asm, clang::Decl::getAttr(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), clang::ValueDecl::getType(), and clang::CodeGen::LValue::MakeGlobalReg().

Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue().

◆ EmitGlobalVarDeclLValue()

◆ emitHashMix()

llvm::Value * emitHashMix ( CGBuilderTy & Builder,
llvm::Value * Acc,
llvm::Value * Ptr )
static

Definition at line 725 of file CGExpr.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitTypeCheck().

◆ EmitLoadOfMatrixLValue()

◆ EmitLValueOrThrowExpression()

std::optional< LValue > EmitLValueOrThrowExpression ( CodeGenFunction & CGF,
const Expr * Operand )
static

Emit the operand of a glvalue conditional operator.

This is either a glvalue or a (possibly-parenthesized) throw-expression. If this is a throw, no LValue is returned and the current block has been terminated.

Definition at line 6196 of file CGExpr.cpp.

References clang::CodeGen::CodeGenFunction::EmitCXXThrowExpr(), and clang::CodeGen::CodeGenFunction::EmitLValue().

Referenced by clang::CodeGen::CodeGenFunction::EmitConditionalOperatorLValue().

◆ emitOMPArraySectionBase()

◆ emitPointerArithmetic()

◆ EmitPointerWithAlignment()

Address EmitPointerWithAlignment ( const Expr * E,
LValueBaseInfo * BaseInfo,
TBAAAccessInfo * TBAAInfo,
KnownNonNull_t IsKnownNonNull,
CodeGenFunction & CGF )
static

Definition at line 1479 of file CGExpr.cpp.

References clang::Addr, clang::CodeGen::CodeGenFunction::authPointerToPointerCast(), clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CFITCK_UnrelatedCast, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateAddrSpaceCast(), clang::CodeGen::Decl, clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(), clang::CodeGen::CodeGenModule::EmitExplicitCastExprType(), clang::CodeGen::CodeGenFunction::EmitLValue(), emitPointerArithmetic(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitVTablePtrCheckForCast(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), clang::CodeGen::LValueBaseInfo::getAlignmentSource(), clang::Type::getAs(), clang::CodeGen::CodeGenModule::getNaturalPointeeTypeAlignment(), clang::Type::getPointeeType(), clang::CodeGen::CodeGenModule::getTBAAAccessInfo(), clang::CodeGen::Address::getType(), clang::Expr::getType(), clang::SanitizerSet::has(), clang::Expr::IgnoreParens(), clang::isa(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::CodeGen::CodeGenFunction::makeNaturalAddressForPointer(), clang::CodeGen::CodeGenModule::mergeTBAAInfoForCast(), clang::CodeGen::CodeGenFunction::SanOpts, and clang::CodeGen::CodeGenFunction::ShouldNullCheckClassCastValue().

Referenced by clang::CodeGen::CodeGenFunction::EmitAtomicExpr().

◆ emitPreserveStructAccess()

◆ emitPseudoObjectExpr()

◆ emitRawAddrOfFieldStorage()

◆ EmitStoreOfMatrixScalar()

void EmitStoreOfMatrixScalar ( llvm::Value * value,
LValue lvalue,
bool isInit,
CodeGenFunction & CGF )
static

◆ EmitThreadPrivateVarDeclLValue()

◆ getArrayElementAlign()

CharUnits getArrayElementAlign ( CharUnits arrayAlign,
llvm::Value * idx,
CharUnits eltSize )
static

◆ getArrayIndexingBound()

llvm::Value * getArrayIndexingBound ( CodeGenFunction & CGF,
const Expr * Base,
QualType & IndexedType,
LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel )
static

◆ getFieldOffsetInBits()

◆ getGEPIndicesToField()

◆ getGlobalDeclForDirectCall()

GlobalDecl getGlobalDeclForDirectCall ( const FunctionDecl * FD)
static

Definition at line 6753 of file CGExpr.cpp.

References clang::Decl::getAttr(), and clang::Stub.

Referenced by clang::CodeGen::CodeGenFunction::EmitCallee().

◆ getOffsetDifferenceInBits()

std::optional< int64_t > getOffsetDifferenceInBits ( CodeGenFunction & CGF,
const FieldDecl * FD1,
const FieldDecl * FD2 )
static

Returns the relative offset difference between FD1 and FD2.

offsetof(struct foo, FD1) - offsetof(struct foo, FD2)
#define offsetof(t, d)

Both fields must be within the same struct.

Definition at line 5022 of file CGExpr.cpp.

References getFieldOffsetInBits(), clang::DeclContext::getOuterLexicalRecordContext(), and clang::FieldDecl::getParent().

Referenced by clang::CodeGen::CodeGenFunction::EmitCountedByBoundsChecking().

◆ getRangeForType()

bool getRangeForType ( CodeGenFunction & CGF,
QualType Ty,
llvm::APInt & Min,
llvm::APInt & End,
bool StrictEnums,
bool StrictBool,
bool IsBool )
static

◆ getRecoverableKind()

CheckRecoverableKind getRecoverableKind ( SanitizerKind::SanitizerOrdinal Ordinal)
static

Definition at line 4216 of file CGExpr.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitCheck().

◆ GetUBSanTrapForHandler()

llvm::StringRef GetUBSanTrapForHandler ( SanitizerHandler ID)
static

Definition at line 97 of file CGExpr.cpp.

References LIST_SANITIZER_CHECKS.

Referenced by clang::CodeGen::CodeGenFunction::EmitTrapCheck().

◆ hasAnyVptr()

bool hasAnyVptr ( const QualType Type,
const ASTContext & Context )
static

◆ hasBPFPreserveStaticOffset() [1/2]

bool hasBPFPreserveStaticOffset ( const Expr * E)
static

◆ hasBPFPreserveStaticOffset() [2/2]

bool hasBPFPreserveStaticOffset ( const RecordDecl * D)
static

◆ isConstantEmittableObjectType()

bool isConstantEmittableObjectType ( QualType type)
static

Given an object of the given canonical type, can we safely copy a value out of it based on its initializer?

Definition at line 1909 of file CGExpr.cpp.

References clang::RecordDecl::getDefinitionOrSelf(), clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), and clang::ast_matchers::type.

Referenced by checkVarTypeForConstantEmission().

◆ IsPreserveAIArrayBase()

bool IsPreserveAIArrayBase ( CodeGenFunction & CGF,
const Expr * ArrayBase )
static

Given an array base, check whether its member access belongs to a record with preserve_access_index attribute or not.

Definition at line 4884 of file CGExpr.cpp.

References clang::CodeGen::CodeGenFunction::getDebugInfo(), clang::PointerType::getPointeeType(), clang::Type::getUnqualifiedDesugaredType(), clang::Type::hasAttr(), and clang::Expr::IgnoreImpCasts().

Referenced by emitArraySubscriptGEP().

◆ isSimpleArrayDecayOperand()

const Expr * isSimpleArrayDecayOperand ( const Expr * E)
static

isSimpleArrayDecayOperand - If the specified expr is a simple decay from an array to pointer, return the array subexpression.

Definition at line 4799 of file CGExpr.cpp.

References clang::FullExpr::getSubExpr(), clang::Expr::getType(), and clang::Type::isVariableArrayType().

Referenced by clang::CodeGen::CodeGenFunction::EmitArraySectionExpr(), and clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr().

◆ MaybeConvertMatrixAddress()

◆ pushTemporaryCleanup()

void pushTemporaryCleanup ( CodeGenFunction & CGF,
const MaterializeTemporaryExpr * M,
const Expr * E,
Address ReferenceTemporary )
static

Definition at line 366 of file CGExpr.cpp.

References clang::cast(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::destroyARCStrongImprecise, clang::CodeGen::CodeGenFunction::destroyARCStrongPrecise, clang::CodeGen::CodeGenFunction::destroyARCWeak, clang::CodeGen::CodeGenFunction::destroyCXXObject, clang::QualType::DK_none, clang::Dtor_Complete, clang::CodeGen::EHCleanup, clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::generateDestroyHelper(), clang::CodeGen::CodeGenModule::getAddrAndTypeOfCXXStructor(), clang::CodeGen::CodeGenFunction::getARCCleanupKind(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::MaterializeTemporaryExpr::getExtendingDecl(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::QualType::getObjCLifetime(), clang::MaterializeTemporaryExpr::getStorageDuration(), clang::Expr::getType(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::Type::isArrayType(), clang::QualType::isDestructedType(), clang::CodeGen::NormalAndEHCleanup, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::CodeGen::CodeGenFunction::pushDestroy(), clang::CodeGen::CodeGenFunction::pushLifetimeExtendedDestroy(), clang::CodeGen::CGCXXABI::registerGlobalDtor(), clang::SD_Automatic, clang::SD_Dynamic, clang::SD_FullExpression, clang::SD_Static, and clang::SD_Thread.

◆ RecordContainsField()

bool RecordContainsField ( const RecordDecl * RD,
const FieldDecl * Field )
static

Returns true if Field is reachable from RD either as a direct field or through a chain of nested record fields (including anonymous structs/unions).

This mirrors the GEP path that getGEPIndicesToField builds, and is used to identify the right anchor expression in Base.

Definition at line 1062 of file CGExpr.cpp.

References clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::Type::isRecordType(), and RecordContainsField().

Referenced by RecordContainsField().

◆ setObjCGCLValueClass()

◆ tryToConvertMemberExprToDeclRefExpr()

◆ wrapWithBPFPreserveStaticOffset()

Variable Documentation

◆ SanitizerHandlers

const SanitizerHandlerInfo SanitizerHandlers[]
Initial value:
= {
#define SANITIZER_CHECK(Enum, Name, Version, Msg)
}
#define LIST_SANITIZER_CHECKS

Definition at line 4233 of file CGExpr.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitCheck(), and emitCheckHandlerCall().