33 #include "llvm/IR/DataLayout.h" 34 #include "llvm/IR/GlobalVariable.h" 35 #include "llvm/IR/Intrinsics.h" 36 #include "llvm/IR/Type.h" 38 using namespace clang;
39 using namespace CodeGen;
43 case Decl::BuiltinTemplate:
44 case Decl::TranslationUnit:
45 case Decl::ExternCContext:
47 case Decl::UnresolvedUsingTypename:
48 case Decl::ClassTemplateSpecialization:
49 case Decl::ClassTemplatePartialSpecialization:
50 case Decl::VarTemplateSpecialization:
51 case Decl::VarTemplatePartialSpecialization:
52 case Decl::TemplateTypeParm:
53 case Decl::UnresolvedUsingValue:
54 case Decl::NonTypeTemplateParm:
55 case Decl::CXXDeductionGuide:
57 case Decl::CXXConstructor:
58 case Decl::CXXDestructor:
59 case Decl::CXXConversion:
61 case Decl::MSProperty:
62 case Decl::IndirectField:
64 case Decl::ObjCAtDefsField:
66 case Decl::ImplicitParam:
67 case Decl::ClassTemplate:
68 case Decl::VarTemplate:
69 case Decl::FunctionTemplate:
70 case Decl::TypeAliasTemplate:
71 case Decl::TemplateTemplateParm:
72 case Decl::ObjCMethod:
73 case Decl::ObjCCategory:
74 case Decl::ObjCProtocol:
75 case Decl::ObjCInterface:
76 case Decl::ObjCCategoryImpl:
77 case Decl::ObjCImplementation:
78 case Decl::ObjCProperty:
79 case Decl::ObjCCompatibleAlias:
80 case Decl::PragmaComment:
81 case Decl::PragmaDetectMismatch:
82 case Decl::AccessSpec:
83 case Decl::LinkageSpec:
85 case Decl::ObjCPropertyImpl:
86 case Decl::FileScopeAsm:
88 case Decl::FriendTemplate:
91 case Decl::ClassScopeFunctionSpecialization:
92 case Decl::UsingShadow:
93 case Decl::ConstructorUsingShadow:
94 case Decl::ObjCTypeParam:
96 llvm_unreachable(
"Declaration should not be in declstmts!");
100 case Decl::EnumConstant:
101 case Decl::CXXRecord:
102 case Decl::StaticAssert:
105 case Decl::OMPThreadPrivate:
106 case Decl::OMPCapturedExpr:
111 case Decl::NamespaceAlias:
113 DI->EmitNamespaceAlias(cast<NamespaceAliasDecl>(D));
117 DI->EmitUsingDecl(cast<UsingDecl>(D));
119 case Decl::UsingPack:
120 for (
auto *Using : cast<UsingPackDecl>(D).expansions())
123 case Decl::UsingDirective:
125 DI->EmitUsingDirective(cast<UsingDirectiveDecl>(D));
128 case Decl::Decomposition: {
129 const VarDecl &VD = cast<VarDecl>(D);
131 "Should not see file-scope variables inside a function!");
133 if (
auto *DD = dyn_cast<DecompositionDecl>(&VD))
134 for (
auto *B : DD->bindings())
135 if (
auto *HD = B->getHoldingVar())
140 case Decl::OMPDeclareReduction:
144 case Decl::TypeAlias: {
148 if (Ty->isVariablyModifiedType())
169 llvm::GlobalValue::LinkageTypes
Linkage =
192 std::string ContextName;
194 if (
auto *CD = dyn_cast<CapturedDecl>(DC))
195 DC = cast<DeclContext>(CD->getNonClosureContext());
196 if (
const auto *FD = dyn_cast<FunctionDecl>(DC))
198 else if (
const auto *BD = dyn_cast<BlockDecl>(DC))
200 else if (
const auto *OMD = dyn_cast<ObjCMethodDecl>(DC))
201 ContextName = OMD->getSelector().getAsString();
203 llvm_unreachable(
"Unknown context for static var decl");
215 if (llvm::Constant *ExistingGV = StaticLocalDeclMap[&D])
223 if (D.hasAttr<AsmLabelAttr>())
224 Name = getMangledName(&D);
229 LangAS AS = GetGlobalVarAddressSpace(&D);
233 llvm::Constant *Init =
nullptr;
237 Init = llvm::UndefValue::get(LTy);
239 llvm::GlobalVariable *GV =
new llvm::GlobalVariable(
241 nullptr, llvm::GlobalVariable::NotThreadLocal, TargetAS);
245 if (supportsCOMDAT() && GV->isWeakForLinker())
246 GV->setComdat(TheModule.getOrInsertComdat(GV->getName()));
251 if (D.isExternallyVisible()) {
252 if (D.hasAttr<DLLImportAttr>())
253 GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass);
254 else if (D.hasAttr<DLLExportAttr>())
255 GV->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass);
260 llvm::Constant *Addr = GV;
261 if (AS != ExpectedAS) {
262 Addr = getTargetCodeGenInfo().performAddrSpaceCast(
263 *
this, GV, AS, ExpectedAS,
264 LTy->getPointerTo(
getContext().getTargetAddressSpace(ExpectedAS)));
267 setStaticLocalDeclAddress(&D, Addr);
271 const Decl *DC = cast<Decl>(D.getDeclContext());
275 if (isa<BlockDecl>(DC) || isa<CapturedDecl>(DC)) {
283 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(DC))
285 else if (
const auto *DD = dyn_cast<CXXDestructorDecl>(DC))
287 else if (
const auto *FD = dyn_cast<FunctionDecl>(DC))
292 assert(isa<ObjCMethodDecl>(DC) &&
"unexpected parent code decl");
295 (
void)GetAddrOfGlobal(GD);
312 llvm::GlobalVariable *
314 llvm::GlobalVariable *GV) {
326 GV->setConstant(
false);
337 if (GV->getType()->getElementType() != Init->getType()) {
338 llvm::GlobalVariable *OldGV = GV;
340 GV =
new llvm::GlobalVariable(
CGM.
getModule(), Init->getType(),
342 OldGV->getLinkage(), Init,
"",
344 OldGV->getThreadLocalMode(),
346 GV->setVisibility(OldGV->getVisibility());
347 GV->setComdat(OldGV->getComdat());
353 llvm::Constant *NewPtrForOldDecl =
354 llvm::ConstantExpr::getBitCast(GV, OldGV->getType());
355 OldGV->replaceAllUsesWith(NewPtrForOldDecl);
358 OldGV->eraseFromParent();
362 GV->setInitializer(Init);
377 llvm::GlobalValue::LinkageTypes
Linkage) {
386 setAddrOfLocalVar(&D,
Address(addr, alignment));
397 llvm::GlobalVariable *var =
398 cast<llvm::GlobalVariable>(addr->stripPointerCasts());
407 if (D.
getInit() && !isCudaSharedVar)
415 if (
auto *SA = D.
getAttr<PragmaClangBSSSectionAttr>())
416 var->addAttribute(
"bss-section", SA->getName());
417 if (
auto *SA = D.
getAttr<PragmaClangDataSectionAttr>())
418 var->addAttribute(
"data-section", SA->getName());
419 if (
auto *SA = D.
getAttr<PragmaClangRodataSectionAttr>())
420 var->addAttribute(
"rodata-section", SA->getName());
422 if (
const SectionAttr *SA = D.
getAttr<SectionAttr>())
423 var->setSection(SA->getName());
433 llvm::Constant *castedAddr =
434 llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(var, expectedType);
435 if (var != castedAddr)
436 LocalDeclMap.find(&D)->second =
Address(castedAddr, alignment);
454 bool useEHCleanupForArray)
455 : addr(addr),
type(type), destroyer(destroyer),
456 useEHCleanupForArray(useEHCleanupForArray) {}
461 bool useEHCleanupForArray;
465 bool useEHCleanupForArray =
466 flags.isForNormalCleanup() && this->useEHCleanupForArray;
468 CGF.
emitDestroy(addr, type, destroyer, useEHCleanupForArray);
473 DestroyNRVOVariable(
Address addr,
476 : Dtor(Dtor), NRVOFlag(NRVOFlag), Loc(addr) {}
484 bool NRVO = flags.isForNormalCleanup() && NRVOFlag;
486 llvm::BasicBlock *SkipDtorBB =
nullptr;
493 CGF.
Builder.CreateCondBr(DidNRVO, SkipDtorBB, RunDtorBB);
508 CallStackRestore(
Address Stack) : Stack(Stack) {}
518 ExtendGCLifetime(
const VarDecl *var) : Var(*var) {}
532 llvm::Constant *CleanupFn;
536 CallCleanupFunction(llvm::Constant *CleanupFn,
const CGFunctionInfo *Info,
538 : CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var) {}
573 llvm_unreachable(
"present but none");
581 (var.
hasAttr<ObjCPreciseLifetimeAttr>()
605 if (
const Expr *e = dyn_cast<Expr>(s)) {
608 s = e = e->IgnoreParenCasts();
610 if (
const DeclRefExpr *ref = dyn_cast<DeclRefExpr>(e))
611 return (ref->getDecl() == &var);
612 if (
const BlockExpr *be = dyn_cast<BlockExpr>(e)) {
613 const BlockDecl *block = be->getBlockDecl();
614 for (
const auto &I : block->
captures()) {
615 if (I.getVariable() == &var)
630 if (!decl)
return false;
631 if (!isa<VarDecl>(decl))
return false;
638 bool needsCast =
false;
645 case CK_BlockPointerToObjCPointerCast:
651 case CK_LValueToRValue: {
694 if (!
SanOpts.
has(SanitizerKind::NullabilityAssign))
705 llvm::Constant *StaticData[] = {
707 llvm::ConstantInt::get(
Int8Ty, 0),
709 EmitCheck({{IsNotNull, SanitizerKind::NullabilityAssign}},
710 SanitizerHandler::TypeMismatch, StaticData, RHS);
714 LValue lvalue,
bool capturedByInit) {
726 init = DIE->getExpr();
732 init = ewc->getSubExpr();
740 bool accessedByInit =
false;
742 accessedByInit = (capturedByInit ||
isAccessedBy(D, init));
743 if (accessedByInit) {
746 if (capturedByInit) {
771 llvm_unreachable(
"present but none");
830 if (isa<llvm::ConstantAggregateZero>(Init) ||
831 isa<llvm::ConstantPointerNull>(Init) ||
832 isa<llvm::UndefValue>(Init))
834 if (isa<llvm::ConstantInt>(Init) || isa<llvm::ConstantFP>(Init) ||
835 isa<llvm::ConstantVector>(Init) || isa<llvm::BlockAddress>(Init) ||
836 isa<llvm::ConstantExpr>(Init))
837 return Init->isNullValue() || NumStores--;
840 if (isa<llvm::ConstantArray>(Init) || isa<llvm::ConstantStruct>(Init)) {
841 for (
unsigned i = 0, e = Init->getNumOperands(); i != e; ++i) {
842 llvm::Constant *Elt = cast<llvm::Constant>(Init->getOperand(i));
849 if (llvm::ConstantDataSequential *CDS =
850 dyn_cast<llvm::ConstantDataSequential>(Init)) {
851 for (
unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
852 llvm::Constant *Elt = CDS->getElementAsConstant(i);
868 assert(!Init->isNullValue() && !isa<llvm::UndefValue>(Init) &&
869 "called emitStoresForInitAfterMemset for zero or undef value.");
871 if (isa<llvm::ConstantInt>(Init) || isa<llvm::ConstantFP>(Init) ||
872 isa<llvm::ConstantVector>(Init) || isa<llvm::BlockAddress>(Init) ||
873 isa<llvm::ConstantExpr>(Init)) {
878 if (llvm::ConstantDataSequential *CDS =
879 dyn_cast<llvm::ConstantDataSequential>(Init)) {
880 for (
unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
881 llvm::Constant *Elt = CDS->getElementAsConstant(i);
884 if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt))
886 Elt, Builder.CreateConstGEP2_32(Init->getType(), Loc, 0, i),
887 isVolatile, Builder);
892 assert((isa<llvm::ConstantStruct>(Init) || isa<llvm::ConstantArray>(Init)) &&
893 "Unknown value type!");
895 for (
unsigned i = 0, e = Init->getNumOperands(); i != e; ++i) {
896 llvm::Constant *Elt = cast<llvm::Constant>(Init->getOperand(i));
899 if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt))
901 Elt, Builder.CreateConstGEP2_32(Init->getType(), Loc, 0, i),
902 isVolatile, Builder);
911 uint64_t GlobalSize) {
913 if (isa<llvm::ConstantAggregateZero>(Init))
return true;
919 unsigned StoreBudget = 6;
920 uint64_t SizeLimit = 32;
922 return GlobalSize > SizeLimit &&
940 if (!ShouldEmitLifetimeMarkers)
947 C->setDoesNotThrow();
955 C->setDoesNotThrow();
969 bool isByRef = D.
hasAttr<BlocksAttr>();
970 emission.IsByRef = isByRef;
1010 assert(emission.wasEmittedAsGlobal());
1015 emission.IsConstantAggregate =
true;
1028 if (!cast<CXXRecordDecl>(RecordTy->getDecl())->hasTrivialDestructor()) {
1048 allocaTy = byrefInfo.Type;
1049 allocaAlignment = byrefInfo.ByrefAlignment;
1052 allocaAlignment = alignment;
1063 bool IsMSCatchParam =
1085 emission.SizeForLifetimeMarkers =
1095 if (!DidCallStackSave) {
1104 DidCallStackSave =
true;
1113 std::tie(elementCount, elementType) =
getVLASize(Ty);
1121 setAddrOfLocalVar(&D, address);
1122 emission.Addr = address;
1134 if (D.
hasAttr<AnnotateAttr>())
1153 if (
const BlockExpr *be = dyn_cast<BlockExpr>(e)) {
1154 const BlockDecl *block = be->getBlockDecl();
1155 for (
const auto &I : block->
captures()) {
1156 if (I.getVariable() == &var)
1164 if (
const StmtExpr *SE = dyn_cast<StmtExpr>(e)) {
1166 for (
const auto *BI : CS->
body())
1167 if (
const auto *E = dyn_cast<Expr>(BI)) {
1171 else if (
const auto *DS = dyn_cast<DeclStmt>(BI)) {
1173 for (
const auto *I : DS->decls()) {
1174 if (
const auto *VD = dyn_cast<VarDecl>((I))) {
1175 const Expr *Init = VD->getInit();
1203 if (Constructor->isTrivial() &&
1204 Constructor->isDefaultConstructor() &&
1205 !Construct->requiresZeroInitialization())
1212 assert(emission.Variable &&
"emission was not valid!");
1215 if (emission.wasEmittedAsGlobal())
return;
1217 const VarDecl &D = *emission.Variable;
1232 if (emission.IsByRef)
1241 bool capturedByInit = emission.IsByRef &&
isCapturedBy(D, Init);
1246 llvm::Constant *constant =
nullptr;
1247 if (emission.IsConstantAggregate || D.
isConstexpr()) {
1248 assert(!capturedByInit &&
"constant init contains a capturing block?");
1258 if (!emission.IsConstantAggregate) {
1267 bool isVolatile = type.isVolatileQualified();
1271 getContext().getTypeSizeInChars(type).getQuantity());
1284 if (!constant->isNullValue() && !isa<llvm::UndefValue>(constant)) {
1298 llvm::GlobalVariable *GV =
1299 new llvm::GlobalVariable(
CGM.
getModule(), constant->getType(),
true,
1300 llvm::GlobalValue::PrivateLinkage,
1301 constant, Name,
nullptr,
1302 llvm::GlobalValue::NotThreadLocal, AS);
1304 GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
1327 LValue lvalue,
bool capturedByInit) {
1360 llvm_unreachable(
"bad evaluation kind");
1373 const VarDecl *var = emission.Variable;
1381 llvm_unreachable(
"no cleanup for trivially-destructible variable");
1386 if (emission.NRVOFlag) {
1389 EHStack.pushCleanup<DestroyNRVOVariable>(cleanupKind, addr,
1390 dtor, emission.NRVOFlag);
1403 if (!var->
hasAttr<ObjCPreciseLifetimeAttr>())
1416 bool useEHCleanup = (cleanupKind &
EHCleanup);
1417 EHStack.pushCleanup<DestroyObject>(cleanupKind, addr,
type, destroyer,
1422 assert(emission.Variable &&
"emission was not valid!");
1425 if (emission.wasEmittedAsGlobal())
return;
1431 const VarDecl &D = *emission.Variable;
1439 D.
hasAttr<ObjCPreciseLifetimeAttr>()) {
1444 if (
const CleanupAttr *CA = D.
getAttr<CleanupAttr>()) {
1448 assert(F &&
"Could not find function!");
1456 if (emission.IsByRef)
1471 llvm_unreachable(
"Unknown DestructionKind");
1478 assert(dtorKind &&
"cannot push destructor for trivial type");
1488 assert(dtorKind &&
"cannot push destructor for trivial type");
1497 bool useEHCleanupForArray) {
1498 pushFullExprCleanup<DestroyObject>(cleanupKind, addr,
type,
1499 destroyer, useEHCleanupForArray);
1503 EHStack.pushCleanup<CallStackRestore>(
Kind, SPMem);
1508 Destroyer *destroyer,
bool useEHCleanupForArray) {
1510 "performing lifetime extension from within conditional");
1516 EHStack.pushCleanup<DestroyObject>(
1518 destroyer, useEHCleanupForArray);
1522 pushCleanupAfterFullExpr<DestroyObject>(
1523 cleanupKind, addr,
type, destroyer, useEHCleanupForArray);
1539 bool useEHCleanupForArray) {
1542 return destroyer(*
this, addr, type);
1551 bool checkZeroLength =
true;
1554 if (llvm::ConstantInt *constLength = dyn_cast<llvm::ConstantInt>(length)) {
1556 if (constLength->isZero())
return;
1557 checkZeroLength =
false;
1563 checkZeroLength, useEHCleanupForArray);
1581 bool checkZeroLength,
1582 bool useEHCleanup) {
1590 if (checkZeroLength) {
1592 "arraydestroy.isempty");
1593 Builder.CreateCondBr(isEmpty, doneBB, bodyBB);
1597 llvm::BasicBlock *entryBB =
Builder.GetInsertBlock();
1599 llvm::PHINode *elementPast =
1600 Builder.CreatePHI(begin->getType(), 2,
"arraydestroy.elementPast");
1601 elementPast->addIncoming(end, entryBB);
1606 "arraydestroy.element");
1613 destroyer(*
this,
Address(element, elementAlign), elementType);
1620 Builder.CreateCondBr(done, doneBB, bodyBB);
1621 elementPast->addIncoming(element,
Builder.GetInsertBlock());
1634 unsigned arrayDepth = 0;
1646 begin = CGF.
Builder.CreateInBoundsGEP(begin, gepIndices,
"pad.arraybegin");
1647 end = CGF.
Builder.CreateInBoundsGEP(end, gepIndices,
"pad.arrayend");
1671 : ArrayBegin(arrayBegin), ArrayEnd(arrayEnd),
1672 ElementType(elementType),
Destroyer(destroyer),
1673 ElementAlign(elementAlign) {}
1677 ElementType, ElementAlign, Destroyer);
1691 IrregularPartialArrayDestroy(
llvm::Value *arrayBegin,
1696 : ArrayBegin(arrayBegin), ArrayEndPointer(arrayEndPointer),
1697 ElementType(elementType),
Destroyer(destroyer),
1698 ElementAlign(elementAlign) {}
1703 ElementType, ElementAlign, Destroyer);
1719 pushFullExprCleanup<IrregularPartialArrayDestroy>(
EHCleanup,
1720 arrayBegin, arrayEndPointer,
1721 elementType, elementAlign,
1736 pushFullExprCleanup<RegularPartialArrayDestroy>(
EHCleanup,
1737 arrayBegin, arrayEnd,
1738 elementType, elementAlign,
1744 if (LifetimeStartFn)
1745 return LifetimeStartFn;
1746 LifetimeStartFn = llvm::Intrinsic::getDeclaration(&getModule(),
1748 return LifetimeStartFn;
1754 return LifetimeEndFn;
1755 LifetimeEndFn = llvm::Intrinsic::getDeclaration(&getModule(),
1757 return LifetimeEndFn;
1768 : Param(param), Precise(precise) {}
1784 assert((isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)) &&
1785 "Invalid argument to EmitParmDecl");
1792 if (
auto IPD = dyn_cast<ImplicitParamDecl>(&D)) {
1802 bool DoStore =
false;
1808 unsigned AS = DeclPtr.
getType()->getAddressSpace();
1810 if (DeclPtr.
getType() != IRTy)
1839 bool isConsumed = D.
hasAttr<NSConsumedAttr>();
1898 setAddrOfLocalVar(&D, DeclPtr);
1908 if (D.
hasAttr<AnnotateAttr>())
1914 if (requiresReturnValueNullabilityCheck()) {
1918 RetValNullabilityPrecondition =
1919 Builder.CreateAnd(RetValNullabilityPrecondition,
1927 if (!LangOpts.OpenMP || (!LangOpts.EmitAllDecls && !D->
isUsed()))
1929 getOpenMPRuntime().emitUserDefinedReduction(CGF, D);
const llvm::DataLayout & getDataLayout() const
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
ReturnValueSlot - Contains the address where the return value of a function can be stored...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
An instance of this class is created to represent a function declaration or definition.
void EmitStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
llvm::Value * EmitARCRetainAutoreleaseScalarExpr(const Expr *expr)
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
A (possibly-)qualified type.
void EmitExtendGCLifetime(llvm::Value *object)
EmitExtendGCLifetime - Given a pointer to an Objective-C object, make sure it survives garbage collec...
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
CodeGenTypes & getTypes()
llvm::Type * ConvertTypeForMem(QualType T)
const CodeGenOptions & getCodeGenOpts() const
void EmitVarDecl(const VarDecl &D)
EmitVarDecl - Emit a local variable declaration.
llvm::Constant * EmitCheckTypeDescriptor(QualType T)
Emit a description of a type in a format suitable for passing to a runtime sanitizer handler...
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
Stmt - This represents one statement.
llvm::Constant * tryEmitForInitializer(const VarDecl &D)
Try to emit the initiaizer of the given declaration as an abstract constant.
Defines the SourceManager interface.
static bool canEmitInitWithFewStoresAfterMemset(llvm::Constant *Init, unsigned &NumStores)
canEmitInitWithFewStoresAfterMemset - Decide whether we can emit the non-zero parts of the specified ...
bool isRecordType() const
bool hasLabelBeenSeenInCurrentScope() const
Return true if a label was seen in the current scope.
void emitAutoVarTypeCleanup(const AutoVarEmission &emission, QualType::DestructionKind dtorKind)
Enter a destroy cleanup for the given local variable.
Decl - This represents one declaration (or definition), e.g.
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
void EmitCheck(ArrayRef< std::pair< llvm::Value *, SanitizerMask >> Checked, SanitizerHandler Check, ArrayRef< llvm::Constant *> StaticArgs, ArrayRef< llvm::Value *> DynamicArgs)
Create a basic block that will call a handler function in a sanitizer runtime with the provided argum...
void EmitAutoVarDecl(const VarDecl &D)
EmitAutoVarDecl - Emit an auto variable declaration.
static Destroyer destroyARCStrongPrecise
void pushLifetimeExtendedDestroy(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represents a call to a C++ constructor.
void EmitARCCopyWeak(Address dst, Address src)
void @objc_copyWeak(i8** dest, i8** src) Disregards the current value in dest.
llvm::Value * EmitARCRetainNonBlock(llvm::Value *value)
Retain the given object, with normal retain semantics.
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Represents a C++ constructor within a class.
static Destroyer destroyARCWeak
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::Instruction **callOrInvoke, SourceLocation Loc)
EmitCall - Generate a call of the given function, expecting the given result type, and using the given argument list which specifies both the LLVM arguments and the types they were derived from.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Address getObjectAddress(CodeGenFunction &CGF) const
Returns the address of the object within this declaration.
RAII object to set/unset CodeGenFunction::IsSanitizerScope.
const T * getAs() const
Member-template getAs<specific type>'.
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
ObjCMethodDecl - Represents an instance or class method declaration.
void EmitVariablyModifiedType(QualType Ty)
EmitVLASize - Capture all the sizes for the VLA expressions in the given variably-modified type and s...
llvm::Value * getPointer() const
bool useLifetimeMarkers() const
llvm::Type * ConvertTypeForMem(QualType T)
ConvertTypeForMem - Convert type T into a llvm::Type.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
The collection of all-type qualifiers we support.
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
const TargetInfo & getTarget() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
void emitDestroy(Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
emitDestroy - Immediately perform the destruction of the given object.
void emitByrefStructureInit(const AutoVarEmission &emission)
Initialize the structural components of a __block variable, i.e.
Address getAddress() const
CGDebugInfo * getDebugInfo()
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Constant * tryEmitAbstractForInitializer(const VarDecl &D)
Try to emit the initializer of the given declaration as an abstract constant.
void EmitExprAsInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
EmitExprAsInit - Emits the code necessary to initialize a location in memory with the given initializ...
Address getIndirectAddress() const
llvm::IntegerType * Int64Ty
RValue EmitReferenceBindingToExpr(const Expr *E)
Emits a reference binding to the passed in expression.
llvm::IntegerType * SizeTy
Qualifiers::ObjCLifetime getObjCLifetime() const
bool isReferenceType() const
void pushEHDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushEHDestroy - Push the standard destructor for the given type as an EH-only cleanup.
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
Address getAllocatedAddress() const
Returns the raw, allocated address, which is not necessarily the address of the object itself...
CleanupKind getCleanupKind(QualType::DestructionKind kind)
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
void setNonGC(bool Value)
llvm::Constant * getLLVMLifetimeStartFn()
Lazily declare the .lifetime.start intrinsic.
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
llvm::Value * EmitARCStoreStrongCall(Address addr, llvm::Value *value, bool resultIgnored)
Store into a strong object.
void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin, llvm::Value *arrayEnd, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushRegularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the gi...
static bool hasScalarEvaluationKind(QualType T)
static void drillIntoBlockVariable(CodeGenFunction &CGF, LValue &lvalue, const VarDecl *var)
Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Cast the element type of the given address to a different type, preserving information like the align...
CharUnits - This is an opaque type for sizes expressed in character units.
static bool shouldUseMemSetPlusStoresToInitialize(llvm::Constant *Init, uint64_t GlobalSize)
shouldUseMemSetPlusStoresToInitialize - Decide whether we should use memset plus some stores to initi...
void EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D, CodeGenFunction *CGF=nullptr)
Emit a code for declare reduction construct.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl)
Emit information about a global variable.
CharUnits getAlignment() const
Return the alignment of this pointer.
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind...
const_arg_iterator arg_begin() const
llvm::Value * EmitARCUnsafeUnretainedScalarExpr(const Expr *expr)
EmitARCUnsafeUnretainedScalarExpr - Semantically equivalent to immediately releasing the resut of Emi...
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
Values of this type can never be null.
Scope - A scope is a transient data structure that is used while parsing the program.
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
llvm::Value * EmitARCRetainScalarExpr(const Expr *expr)
EmitARCRetainScalarExpr - Semantically equivalent to EmitARCRetainObject(e->getType(), EmitScalarExpr(e)), but making a best-effort attempt to peephole expressions that naturally produce retained objects.
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
void EmitAtomicInit(Expr *E, LValue lvalue)
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
CharUnits getPointerAlign() const
static bool ContainsLabel(const Stmt *S, bool IgnoreCaseStmts=false)
ContainsLabel - Return true if the statement contains a label in it.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
CreateTempAlloca - This creates an alloca and inserts it into the entry block if ArraySize is nullptr...
This object can be modified without requiring retains or releases.
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
static CharUnits One()
One - Construct a CharUnits quantity of one.
CompoundStmt - This represents a group of statements like { stmt stmt }.
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
AutoVarEmission EmitAutoVarAlloca(const VarDecl &var)
EmitAutoVarAlloca - Emit the alloca and debug information for a local variable.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
ASTContext & getContext() const
const CodeGen::CGBlockInfo * BlockInfo
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
void setAddress(Address address)
CleanupKind getARCCleanupKind()
Retrieves the default cleanup kind for an ARC cleanup.
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)
llvm::Constant * getNullPointer(llvm::PointerType *T, QualType QT)
Get target specific null pointer.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
llvm::Value * EmitARCStoreWeak(Address addr, llvm::Value *value, bool ignored)
i8* @objc_storeWeak(i8** addr, i8* value) Returns value.
void EmitCXXGuardedInit(const VarDecl &D, llvm::GlobalVariable *DeclPtr, bool PerformInit)
Emit code in this function to perform a guarded variable initialization.
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
void EmitARCMoveWeak(Address dst, Address src)
void @objc_moveWeak(i8** dest, i8** src) Disregards the current value in dest.
Emit only debug info necessary for generating line number tables (-gline-tables-only).
void EmitAutoVarInit(const AutoVarEmission &emission)
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)
Add global annotations that are set on D, for the global GV.
bool hasLocalStorage() const
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable...
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
const FunctionProtoType * T
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
virtual void EmitWorkGroupLocalVarDecl(CodeGenFunction &CGF, const VarDecl &D)
Emit the IR required for a work-group-local variable declaration, and add an entry to CGF's LocalDecl...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
llvm::PointerType * getType() const
Return the type of the pointer value.
ObjCLifetime getObjCLifetime() const
DeclContext * getDeclContext()
void add(RValue rvalue, QualType type, bool needscopy=false)
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
llvm::LLVMContext & getLLVMContext()
void EmitNullabilityCheck(LValue LHS, llvm::Value *RHS, SourceLocation Loc)
Given an assignment *LHS = RHS, emit a test that checks if RHS is nonnull, if LHS is marked _Nonnull...
llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant)
Returns LLVM linkage for a declarator.
Checking the value assigned to a _Nonnull pointer. Must not be null.
bool hasNonTrivialDestructor() const
Determine whether this class has a non-trivial destructor (C++ [class.dtor]p3)
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
llvm::PointerType * AllocaInt8PtrTy
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
void emitArrayDestroy(llvm::Value *begin, llvm::Value *end, QualType elementType, CharUnits elementAlign, Destroyer *destroyer, bool checkZeroLength, bool useEHCleanup)
emitArrayDestroy - Destroys all the elements of the given array, beginning from last to first...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
static bool hasNontrivialDestruction(QualType T)
hasNontrivialDestruction - Determine whether a type's destruction is non-trivial. ...
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)
const LangOptions & getLangOpts() const
ASTContext & getContext() const
ImplicitParamDecl * getSelfDecl() const
static bool isCapturedBy(const VarDecl &var, const Expr *e)
Determines whether the given __block variable is potentially captured by the given expression...
GlobalDecl - represents a global declaration.
VarBypassDetector Bypasses
The l-value was considered opaque, so the alignment was determined from a type.
void setBlockContextParameter(const ImplicitParamDecl *D, unsigned argNum, llvm::Value *ptr)
void enterByrefCleanup(const AutoVarEmission &emission)
Enter a cleanup to destroy a __block variable.
llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
There is no lifetime qualification on this type.
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Assigning into this object requires the old value to be released and the new value to be retained...
llvm::GlobalVariable * AddInitializerToStaticVarDecl(const VarDecl &D, llvm::GlobalVariable *GV)
AddInitializerToStaticVarDecl - Add the initializer for 'D' to the global variable that has already b...
void pushDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushDestroy - Push the standard destructor for the given type as at least a normal cleanup...
Encodes a location in the source.
void EnsureInsertPoint()
EnsureInsertPoint - Ensure that an insertion point is defined so that emitted IR has a place to go...
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
Release the given object.
LValue EmitDeclRefLValue(const DeclRefExpr *E)
This represents '#pragma omp declare reduction ...' directive.
LangAS getAddressSpace() const
Return the address space of this type.
static std::string getStaticDeclName(CodeGenModule &CGM, const VarDecl &D)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
static void emitPartialArrayDestroy(CodeGenFunction &CGF, llvm::Value *begin, llvm::Value *end, QualType type, CharUnits elementAlign, CodeGenFunction::Destroyer *destroyer)
Perform partial array destruction as if in an EH cleanup.
const Decl * getDecl() const
const BlockByrefInfo & getBlockByrefInfo(const VarDecl *var)
BuildByrefInfo - This routine changes a __block variable declared as T x into:
llvm::Value * EmitLifetimeStart(uint64_t Size, llvm::Value *Addr)
Emit a lifetime.begin marker if some criteria are satisfied.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
static bool isAccessedBy(const VarDecl &var, const Stmt *s)
SanitizerSet SanOpts
Sanitizers enabled for this function.
This file defines OpenMP nodes for declarative directives.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
bool isTrivialInitializer(const Expr *Init)
Determine whether the given initializer is trivial in the sense that it requires no code to be genera...
bool isObjCObjectPointerType() const
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
static void EmitAutoVarWithLifetime(CodeGenFunction &CGF, const VarDecl &var, Address addr, Qualifiers::ObjCLifetime lifetime)
EmitAutoVarWithLifetime - Does the setup required for an automatic variable with lifetime.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
void EmitParmDecl(const VarDecl &D, ParamValue Arg, unsigned ArgNo)
EmitParmDecl - Emit a ParmVarDecl or an ImplicitParamDecl.
Assigning into this object requires a lifetime extension.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
llvm::Value * getDirectValue() const
llvm::Constant * getLLVMLifetimeEndFn()
Lazily declare the .lifetime.end intrinsic.
void enterFullExpression(const ExprWithCleanups *E)
void EmitDecl(const Decl &D)
EmitDecl - Emit a declaration.
static Destroyer destroyARCStrongImprecise
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type, returning the result.
void addUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.used metadata.
Base class for declarations which introduce a typedef-name.
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
Dataflow Directional Tag Classes.
static ApplyDebugLocation CreateDefaultArtificial(CodeGenFunction &CGF, SourceLocation TemporaryLocation)
Apply TemporaryLocation if it is valid.
void EmitCXXDestructorCall(const CXXDestructorDecl *D, CXXDtorType Type, bool ForVirtualBase, bool Delegating, Address This)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ArrayRef< Capture > captures() const
const CGFunctionInfo & arrangeFunctionDeclaration(const FunctionDecl *FD)
Free functions are functions that are compatible with an ordinary C function pointer type...
QualType getUnderlyingType() const
const Expr * getInit() const
bool isInConditionalBranch() const
isInConditionalBranch - Return true if we're currently emitting one branch or the other of a conditio...
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
llvm::IntegerType * IntPtrTy
bool areArgsDestroyedLeftToRightInCallee() const
Are arguments to a call destroyed left to right in the callee? This is a fundamental language change...
llvm::Value * getAnyValue() const
Decl * getNonClosureContext()
Find the innermost non-closure ancestor of this declaration, walking up through blocks, lambdas, etc.
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type *> Tys=None)
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::Module & getModule() const
static bool tryEmitARCCopyWeakInit(CodeGenFunction &CGF, const LValue &destLV, const Expr *init)
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type. ...
void EmitAutoVarCleanups(const AutoVarEmission &emission)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
CodeGenTypes & getTypes() const
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant...
llvm::Type * getElementType() const
Return the type of the values stored in this address.
bool isAtomicType() const
llvm::PointerType * Int8PtrTy
llvm::LoadInst * CreateFlagLoad(llvm::Value *Addr, const llvm::Twine &Name="")
Emit a load from an i1 flag variable.
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the given function.
StringRef getMangledName(GlobalDecl GD)
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
void EmitARCInitWeak(Address addr, llvm::Value *value)
i8* @objc_initWeak(i8** addr, i8* value) Returns value.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
bool IsBypassed(const VarDecl *D) const
Returns true if the variable declaration was by bypassed by any goto or switch statement.
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
ComplexPairTy EmitComplexExpr(const Expr *E, bool IgnoreReal=false, bool IgnoreImag=false)
EmitComplexExpr - Emit the computation of the specified expression of complex type, returning the result.
A use of a default initializer in a constructor or in aggregate initialization.
static llvm::Constant * EmitNullConstant(CodeGenModule &CGM, const RecordDecl *record, bool asCompleteObject)
Reading or writing from this object requires a barrier call.
llvm::DenseMap< const VarDecl *, llvm::Value * > NRVOFlags
A mapping from NRVO variables to the flags used to indicate when the NRVO has been applied to this va...
static void emitStoresForInitAfterMemset(llvm::Constant *Init, llvm::Value *Loc, bool isVolatile, CGBuilderTy &Builder)
emitStoresForInitAfterMemset - For inits that canEmitInitWithFewStoresAfterMemset returned true for...
Represents a C++ struct/union/class.
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
llvm::Type * ConvertType(QualType T)
static Destroyer destroyCXXObject
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
LValue EmitLValue(const Expr *E)
EmitLValue - Emit code to compute a designator that specifies the location of the expression...
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
void pushStackRestore(CleanupKind kind, Address SPMem)
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
std::pair< llvm::Value *, QualType > getVLASize(const VariableArrayType *vla)
getVLASize - Returns an LLVM value that corresponds to the size, in non-variably-sized elements...
Defines the clang::TargetInfo interface.
void finalize(llvm::GlobalVariable *global)
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
llvm::Value * getSizeForLifetimeMarkers() const
void setLocation(SourceLocation Loc)
Update the current source location.
A reference to a declared variable, function, enum, etc.
static RValue get(llvm::Value *V)
void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr)
llvm::Constant * EmitCheckSourceLocation(SourceLocation Loc)
Emit a description of a source location in a format suitable for passing to a runtime sanitizer handl...
bool isLocalVarDecl() const
isLocalVarDecl - Returns true for local variable declarations other than parameters.
An l-value expression is a reference to an object with independent storage.
LValue - This represents an lvalue references.
Information for lazily generating a cleanup.
void EmitVarAnnotations(const VarDecl *D, llvm::Value *V)
Emit local annotations for the local variable V, declared by D.
Automatic storage duration (most local variables).
SanitizerMetadata * getSanitizerMetadata()
bool isConstant(const ASTContext &Ctx) const
bool CurFuncIsThunk
In C++, whether we are code generating a thunk.
const LangOptions & getLangOpts() const
unsigned getTargetAddressSpace(QualType T) const
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, Address &addr)
emitArrayLength - Compute the length of an array, even if it's a VLA, and drill down to the base elem...
CallArgList - Type for representing both the value and type of arguments in a call.
Address CreateMemTemp(QualType T, const Twine &Name="tmp", bool CastToDefaultAddrSpace=true)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignment...
void PopCleanupBlock(bool FallThroughIsBranchThrough=false)
PopCleanupBlock - Will pop the cleanup entry on the stack and process all branch fixups.
llvm::Value * getPointer() const
Address emitBlockByrefAddress(Address baseAddr, const VarDecl *V, bool followForward=true)
BuildBlockByrefAddress - Computes the location of the data in a variable which is declared as __block...
SourceLocation getLocation() const
void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushIrregularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the ...
bool isExternallyVisible() const
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty)
static CharUnits getDeclAlign(Expr *E, CharUnits TypeAlign, ASTContext &Context)
A helper function to get the alignment of a Decl referred to by DeclRefExpr or MemberExpr.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.