clang 22.0.0git
|
#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/NSAPI.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 "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.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 |
The JSON file list parser is used to communicate input to InstallAPI. | |
Macros | |
#define | SANITIZER_CHECK(Enum, Name, Version, Msg) |
#define | SANITIZER_CHECK(Enum, Name, Version, Msg) {#Name, Version}, |
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? 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. More... | |
Functions | |
llvm::cl::opt< bool > | clang::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 bool | isAAPCS (const TargetInfo &TargetInfo) |
Helper method to check if the underlying ABI is AAPCS. | |
static llvm::Value * | emitHashMix (CGBuilderTy &Builder, llvm::Value *Acc, llvm::Value *Ptr) |
static llvm::Value * | getArrayIndexingBound (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 | 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 QualType | getConstantExprReferredType (const FullExpr *E, const ASTContext &Ctx) |
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 DeclRefExpr * | tryToConvertMemberExprToDeclRefExpr (CodeGenFunction &CGF, const MemberExpr *ME) |
static bool | getRangeForType (CodeGenFunction &CGF, QualType Ty, llvm::APInt &Min, llvm::APInt &End, bool StrictEnums, 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 Expr * | isSimpleArrayDecayOperand (const Expr *E) |
isSimpleArrayDecayOperand - If the specified expr is a simple decay from an array to pointer, return the array subexpression. | |
static llvm::Value * | emitArraySubscriptGEP (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 *elementType, bool inbounds, bool signedIndices, SourceLocation loc, CharUnits align, const llvm::Twine &name="arrayidx") |
static QualType | getFixedSizeElementType (const ASTContext &ctx, const VariableArrayType *vla) |
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 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 | emitAddrOfFieldStorage (CodeGenFunction &CGF, Address base, const FieldDecl *field, bool IsInBounds) |
Drill down to the storage of a field without walking into reference types. | |
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 bool | OnlyHasInlineBuiltinDeclaration (const FunctionDecl *FD) |
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 [] |
#define SANITIZER_CHECK | ( | Enum, | |
Name, | |||
Version, | |||
Msg | |||
) |
#define SANITIZER_CHECK | ( | Enum, | |
Name, | |||
Version, | |||
Msg | |||
) | {#Name, Version}, |
using RecIndicesTy = SmallVector<llvm::Value *, 8> |
Definition at line 1152 of file CGExpr.cpp.
enum 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 1839 of file CGExpr.cpp.
enum VariableTypeDescriptorKind : uint16_t |
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 74 of file CGExpr.cpp.
|
static |
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.
Definition at line 3158 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CurCodeDecl, E, clang::CodeGen::CodeGenFunction::getContext(), clang::Decl::getDeclContext(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getLLVMLinkageVarDefinition(), and clang::VarDecl::hasLocalStorage().
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue().
|
static |
Definition at line 1845 of file CGExpr.cpp.
References CEK_AsReferenceOnly, CEK_AsValueOnly, CEK_AsValueOrReference, CEK_None, isConstantEmittableObjectType(), and clang::ast_matchers::type.
Referenced by clang::CodeGen::CodeGenFunction::tryEmitAsConstant().
|
static |
Definition at line 455 of file CGExpr.cpp.
References clang::C, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::Default, clang::CodeGen::CodeGenModule::GetAddrOfGlobalTemporary(), clang::CharUnits::getAsAlign(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::GetGlobalConstantAddressSpace(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), clang::MaterializeTemporaryExpr::getStorageDuration(), clang::ASTContext::getTargetAddressSpace(), clang::CodeGen::CodeGenFunction::getTargetHooks(), clang::ASTContext::getTypeAlignInChars(), clang::Init, clang::Type::isArrayType(), clang::QualType::isConstantStorage(), clang::Type::isRecordType(), clang::SD_Automatic, clang::SD_Dynamic, clang::SD_FullExpression, clang::SD_Static, and clang::SD_Thread.
|
static |
Drill down to the storage of a field without walking into reference types.
The resulting address doesn't necessarily have the right type.
Definition at line 5205 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateConstGEP2_32(), clang::CodeGen::CGBuilderTy::CreateStructGEP(), emitAddrOfZeroSizeField(), clang::CodeGen::CodeGenTypes::getCGRecordLayout(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CGRecordLayout::getLLVMFieldNo(), clang::NamedDecl::getName(), clang::FieldDecl::getParent(), clang::CodeGen::CodeGenModule::getTypes(), and clang::CodeGen::isEmptyFieldForLayout().
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField(), and clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization().
|
static |
Get the address of a zero-sized field within a record.
The resulting address doesn't necessarily have the right type.
Definition at line 5188 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateConstByteGEP(), clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getFieldOffset(), clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::ASTContext::toCharUnitsFromBits().
Referenced by emitAddrOfFieldStorage().
|
static |
Definition at line 4297 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), and clang::CodeGen::CodeGenFunction::NotSubtraction.
|
static |
Definition at line 4386 of file CGExpr.cpp.
References clang::ast_matchers::arrayType, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), emitArraySubscriptGEP(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::Address::getAlignment(), getArrayElementAlign(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getDebugInfo(), clang::CodeGen::Address::getElementType(), getFixedSizeElementType(), clang::CodeGen::CGDebugInfo::getOrCreateStandaloneType(), clang::ASTContext::getTypeSizeInChars(), hasBPFPreserveStaticOffset(), clang::CodeGen::CodeGenFunction::IsInPreservedAIRegion, IsPreserveAIArrayBase(), and wrapWithBPFPreserveStaticOffset().
|
static |
Definition at line 4280 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), and clang::CodeGen::CodeGenFunction::NotSubtraction.
Referenced by clang::CodeGen::CodeGenFunction::EmitArraySectionExpr(), clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), and emitArraySubscriptGEP().
|
static |
Definition at line 3121 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::EmitLValueForLambdaField().
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue().
|
static |
Definition at line 3737 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::CurCodeDecl, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Decl::hasAttr(), and SanitizerHandlers.
Referenced by clang::CodeGen::CodeGenFunction::EmitCheck().
|
static |
Definition at line 2975 of file CGExpr.cpp.
References clang::Addr, clang::Type::castAs(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CGOpenMPRuntime::getAddrOfDeclareTargetVar(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::ASTContext::getPointerType(), clang::ValueDecl::getType(), clang::CodeGen::CGOpenMPRuntime::hasRequiresUnifiedSharedMemory(), and clang::CodeGen::Address::invalid().
Referenced by EmitGlobalVarDeclLValue().
|
static |
Definition at line 6000 of file CGExpr.cpp.
References clang::ASTContext::BuiltinInfo, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CGCallee::forBuiltin(), clang::CodeGen::CGCallee::forDirect(), clang::FunctionDecl::getBuiltinID(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getCUDARuntime(), clang::GlobalDecl::getDecl(), clang::CodeGen::CGCUDARuntime::getKernelStub(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::NamedDecl::getName(), clang::CodeGen::CodeGenModule::getRawFunctionPointer(), clang::Decl::hasAttr(), clang::Builtin::Context::isPredefinedLibFunction(), and OnlyHasInlineBuiltinDeclaration().
Referenced by clang::CodeGen::CodeGenFunction::EmitCallee().
|
static |
Definition at line 3108 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::Decl, E, clang::CodeGen::CodeGenFunction::getContext(), clang::GlobalDecl::getDecl(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenModule::getFunctionPointer(), clang::Expr::getType(), clang::Type::isCFIUncheckedCalleeFunctionType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), and V.
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), and clang::CodeGen::CodeGenFunction::EmitMemberExpr().
|
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 3133 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().
|
static |
Definition at line 3057 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenTypes::ConvertTypeForMem(), clang::CodeGen::Decl, E, emitDeclTargetVarDeclLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfReferenceLValue(), clang::CodeGen::CGCXXABI::EmitThreadLocalVarDeclLValue(), EmitThreadPrivateVarDeclLValue(), clang::CodeGen::CodeGenModule::GetAddrOfGlobalVar(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::ASTContext::getDeclAlign(), clang::Expr::getExprLoc(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::VarDecl::getTLSKind(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::Decl::hasAttr(), clang::Type::isReferenceType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), setObjCGCLValueClass(), clang::T, clang::VarDecl::TLS_Dynamic, clang::VarDecl::TLS_None, clang::CodeGen::CGCXXABI::usesThreadWrapperFunction(), and V.
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue().
|
static |
Definition at line 712 of file CGExpr.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitTypeCheck().
|
static |
Definition at line 2310 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::RValue::get(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::LValue::getType(), clang::Type::isConstantMatrixType(), Loc, MaybeConvertMatrixAddress(), and clang::CodeGen::LValue::setAddress().
Referenced by clang::CodeGen::CodeGenFunction::EmitLoadOfLValue().
|
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 5492 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::EmitCXXThrowExpr(), and clang::CodeGen::CodeGenFunction::EmitLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitConditionalOperatorLValue().
|
static |
Definition at line 4797 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::EmitArraySectionExpr(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::LValue::getBaseInfo(), clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(), clang::Type::isArrayType(), clang::Type::isVariableArrayType(), clang::CodeGen::LValueBaseInfo::mergeForCast(), and clang::CodeGen::CodeGenModule::mergeTBAAInfoForCast().
Referenced by clang::CodeGen::CodeGenFunction::EmitArraySectionExpr().
|
static |
Emit pointer + index arithmetic.
Definition at line 1339 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CodeGenFunction::EmitPointerArithmetic(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::Address::getAlignment(), getArrayElementAlign(), clang::CodeGen::Address::getBasePointer(), clang::CodeGen::CodeGenFunction::getContext(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::Type::getPointeeType(), clang::CodeGen::CodeGenModule::getPointerAuthInfoForPointeeType(), clang::BinaryOperator::getRHS(), clang::Expr::getType(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::Address::invalid(), clang::BinaryOperator::isAdditiveOp(), clang::Type::isAnyPointerType(), and clang::CodeGen::NotKnownNonNull.
|
static |
Definition at line 1376 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, E, 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::LValue::getAddress(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), clang::CodeGen::LValueBaseInfo::getAlignmentSource(), clang::Type::getAs(), clang::CodeGen::LValue::getBaseInfo(), clang::CodeGen::CodeGenModule::getNaturalPointeeTypeAlignment(), clang::Type::getPointeeType(), clang::CodeGen::CodeGenModule::getTBAAAccessInfo(), clang::CodeGen::LValue::getTBAAInfo(), clang::Expr::getType(), clang::CodeGen::Address::getType(), clang::SanitizerSet::has(), clang::Expr::IgnoreParens(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::CodeGen::CodeGenFunction::makeNaturalAddressForPointer(), clang::CodeGen::LValueBaseInfo::mergeForCast(), clang::CodeGen::CodeGenModule::mergeTBAAInfoForCast(), clang::CodeGen::CodeGenFunction::SanOpts, and clang::CodeGen::CodeGenFunction::ShouldNullCheckClassCastValue().
|
static |
Definition at line 5221 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreatePreserveStructAccessIndex(), clang::CodeGen::CodeGenTypes::getCGRecordLayout(), clang::CodeGen::CodeGenFunction::getDebugInfo(), clang::CodeGen::CodeGenFunction::getDebugInfoFIndex(), clang::FieldDecl::getFieldIndex(), clang::CodeGen::CGRecordLayout::getLLVMFieldNo(), clang::Decl::getLocation(), clang::CodeGen::CGDebugInfo::getOrCreateStandaloneType(), clang::FieldDecl::getParent(), clang::CodeGen::LValue::getType(), and clang::CodeGen::CodeGenModule::getTypes().
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField().
|
static |
Definition at line 6710 of file CGExpr.cpp.
References clang::CodeGen::AggValueSlot::asRValue(), clang::CodeGen::Decl, E, clang::CodeGen::CodeGenFunction::EmitAggExpr(), clang::CodeGen::CodeGenFunction::EmitAnyExpr(), clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::AggValueSlot::getAddress(), clang::CodeGen::Address::getType(), clang::CodeGen::CodeGenFunction::hasAggregateEvaluationKind(), clang::Expr::isPRValue(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitPseudoObjectLValue(), and clang::CodeGen::CodeGenFunction::EmitPseudoObjectRValue().
|
static |
Definition at line 2235 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::LValue::getBaseInfo(), clang::CodeGen::LValue::getTBAAInfo(), clang::CodeGen::LValue::getType(), clang::CodeGen::LValue::isNontemporal(), clang::CodeGen::LValue::isVolatile(), and MaybeConvertMatrixAddress().
Referenced by clang::CodeGen::CodeGenFunction::EmitStoreOfScalar().
|
static |
Definition at line 2961 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::Decl, clang::CodeGen::CGOpenMPRuntime::getAddrOfThreadPrivate(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), Loc, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), and clang::T.
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), and EmitGlobalVarDeclLValue().
|
static |
Definition at line 1325 of file CGExpr.cpp.
References clang::CharUnits::alignmentAtOffset(), and clang::CharUnits::alignmentOfArrayElement().
|
static |
If Base is known to point to the start of an array, return the length of that array.
Return 0 if the length cannot be determined.
Definition at line 1004 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::Type::castAsArrayTypeUnsafe(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getVLASize(), clang::CodeGen::CodeGenFunction::LoadPassedObjectSize(), and clang::CodeGen::CodeGenFunction::VlaSizePair::NumElts.
Referenced by clang::CodeGen::CodeGenFunction::EmitBoundsCheck().
|
static |
Definition at line 1644 of file CGExpr.cpp.
References E, clang::Type::getPointeeType(), clang::Expr::getType(), and clang::Expr::IgnoreImplicit().
|
static |
The offset of a field from the beginning of the record.
Definition at line 4455 of file CGExpr.cpp.
References clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTRecordLayout::getFieldOffset(), getFieldOffsetInBits(), clang::Type::isRecordType(), and clang::TagDecl::isUnion().
Referenced by getFieldOffsetInBits(), and getOffsetDifferenceInBits().
|
static |
Definition at line 4312 of file CGExpr.cpp.
References clang::ASTContext::getAsVariableArrayType(), and clang::ArrayType::getElementType().
|
static |
Definition at line 1154 of file CGExpr.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGRecordLayout::containsFieldDecl(), clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::CodeGen::CodeGenTypes::getCGRecordLayout(), getGEPIndicesToField(), clang::CodeGen::CGRecordLayout::getLLVMFieldNo(), clang::CodeGen::CodeGenModule::getTypes(), clang::Type::isRecordType(), and clang::TagDecl::isUnion().
Referenced by clang::CodeGen::CodeGenFunction::GetCountedByFieldExprGEP(), and getGEPIndicesToField().
|
static |
Definition at line 6052 of file CGExpr.cpp.
References clang::Decl::getAttr(), and clang::Stub.
Referenced by clang::CodeGen::CodeGenFunction::EmitCallee().
|
static |
Returns the relative offset difference between FD1
and FD2
.
Both fields must be within the same struct.
Definition at line 4486 of file CGExpr.cpp.
References getFieldOffsetInBits(), clang::DeclContext::getOuterLexicalRecordContext(), and clang::FieldDecl::getParent().
Referenced by clang::CodeGen::CodeGenFunction::EmitCountedByBoundsChecking().
|
static |
Definition at line 1984 of file CGExpr.cpp.
References clang::Type::getAsEnumDecl(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::ASTContext::getTypeSize(), and clang::Min.
Referenced by clang::CodeGen::CodeGenFunction::EmitScalarRangeCheck().
|
static |
Definition at line 3714 of file CGExpr.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitCheck().
|
static |
Definition at line 89 of file CGExpr.cpp.
References LIST_SANITIZER_CHECKS.
Referenced by clang::CodeGen::CodeGenFunction::EmitTrapCheck().
|
static |
Definition at line 5234 of file CGExpr.cpp.
References clang::Type::getAsCXXRecordDecl(), and hasAnyVptr().
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField(), and hasAnyVptr().
Definition at line 4325 of file CGExpr.cpp.
References E, clang::Type::getAsRecordDecl(), clang::Type::getPointeeType(), clang::Expr::getType(), hasBPFPreserveStaticOffset(), and clang::QualType::isNull().
|
static |
Definition at line 4321 of file CGExpr.cpp.
References D, and clang::Decl::hasAttr().
Referenced by emitArraySubscriptGEP(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), and hasBPFPreserveStaticOffset().
|
static |
Helper method to check if the underlying ABI is AAPCS.
Definition at line 503 of file CGExpr.cpp.
References clang::TargetInfo::getABI().
Given an object of the given canonical type, can we safely copy a value out of it based on its initializer?
Definition at line 1812 of file CGExpr.cpp.
References clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), and clang::ast_matchers::type.
Referenced by checkVarTypeForConstantEmission().
|
static |
Given an array base, check whether its member access belongs to a record with preserve_access_index attribute or not.
Definition at line 4350 of file CGExpr.cpp.
References E, clang::CodeGen::CodeGenFunction::getDebugInfo(), clang::PointerType::getPointeeType(), clang::Type::getUnqualifiedDesugaredType(), clang::Type::hasAttr(), and clang::Expr::IgnoreImpCasts().
Referenced by emitArraySubscriptGEP().
isSimpleArrayDecayOperand - If the specified expr is a simple decay from an array to pointer, return the array subexpression.
Definition at line 4266 of file CGExpr.cpp.
References E, clang::FullExpr::getSubExpr(), clang::Expr::getType(), and clang::Type::isVariableArrayType().
Referenced by clang::CodeGen::CodeGenFunction::EmitArraySectionExpr(), and clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr().
|
static |
Definition at line 2210 of file CGExpr.cpp.
References clang::Addr.
Referenced by EmitLoadOfMatrixLValue(), clang::CodeGen::CodeGenFunction::EmitMatrixSubscriptExpr(), and EmitStoreOfMatrixScalar().
|
static |
Definition at line 5993 of file CGExpr.cpp.
References clang::Redeclarable< decl_type >::getPreviousDecl().
Referenced by EmitDirectCallee().
|
static |
Definition at line 347 of file CGExpr.cpp.
References 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, E, 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.
|
static |
Definition at line 2864 of file CGExpr.cpp.
References clang::Type::castAs(), E, clang::ASTContext::getLangOpts(), getPointeeType(), clang::Expr::getType(), clang::Type::isArrayType(), clang::CodeGen::LValue::isGlobalObjCRef(), clang::CodeGen::LValue::isObjCArray(), clang::CodeGen::LValue::isObjCIvar(), clang::Type::isPointerType(), clang::Type::isRecordType(), clang::LangOptionsBase::NonGC, clang::CodeGen::LValue::setBaseIvarExp(), clang::CodeGen::LValue::setGlobalObjCRef(), clang::CodeGen::LValue::setObjCArray(), setObjCGCLValueClass(), clang::CodeGen::LValue::setObjCIvar(), clang::CodeGen::LValue::setThreadLocalRef(), and clang::VarDecl::TLS_None.
Referenced by clang::CodeGen::CodeGenFunction::EmitArraySubscriptExpr(), clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), EmitGlobalVarDeclLValue(), clang::CodeGen::CodeGenFunction::EmitMemberExpr(), clang::CodeGen::CodeGenFunction::EmitObjCIvarRefLValue(), and setObjCGCLValueClass().
|
static |
|
static |
Definition at line 4337 of file CGExpr.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenFunction::getTarget(), and clang::TargetInfo::getTriple().
Referenced by emitArraySubscriptGEP(), and clang::CodeGen::CodeGenFunction::EmitLValueForField().
const SanitizerHandlerInfo SanitizerHandlers[] |
Definition at line 3731 of file CGExpr.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitCheck(), and emitCheckHandlerCall().