21 #include "llvm/ADT/DenseSet.h"
22 #include "llvm/ADT/SetVector.h"
23 #include "llvm/Support/Compiler.h"
24 #include "llvm/Support/Format.h"
25 #include "llvm/Transforms/Utils/Cloning.h"
29 using namespace clang;
30 using namespace CodeGen;
33 : CGM(CGM), VTContext(CGM.getContext().getVTableContext()) {}
41 llvm::raw_svector_ostream Out(Name);
50 return GetOrCreateLLVMFunction(Name, Ty, GD,
true,
55 const ThunkInfo &Thunk, llvm::Function *Fn) {
60 llvm::Function *ThunkFn,
bool ForVTable,
71 ThunkFn->setComdat(CGM.
getModule().getOrInsertComdat(ThunkFn->getName()));
79 (isa<PointerType>(typeL) && isa<PointerType>(typeR)) ||
80 (isa<ReferenceType>(typeL) && isa<ReferenceType>(typeR))));
90 llvm::BasicBlock *AdjustNull =
nullptr;
91 llvm::BasicBlock *AdjustNotNull =
nullptr;
92 llvm::BasicBlock *AdjustEnd =
nullptr;
102 CGF.
Builder.CreateCondBr(IsNull, AdjustNull, AdjustNotNull);
109 if (NullCheckValue) {
110 CGF.
Builder.CreateBr(AdjustEnd);
112 CGF.
Builder.CreateBr(AdjustEnd);
115 llvm::PHINode *PHI = CGF.
Builder.CreatePHI(ReturnValue->getType(), 2);
116 PHI->addIncoming(ReturnValue, AdjustNotNull);
117 PHI->addIncoming(llvm::Constant::getNullValue(ReturnValue->getType()),
147 QualType ResultType = FPT->getReturnType();
153 llvm::Function *BaseFn = cast<llvm::Function>(Callee);
156 llvm::ValueToValueMapTy VMap;
157 llvm::Function *NewFn = llvm::CloneFunction(BaseFn, VMap,
160 Fn->replaceAllUsesWith(NewFn);
162 Fn->eraseFromParent();
169 llvm::Function::arg_iterator AI = Fn->arg_begin();
176 llvm::BasicBlock *EntryBB = Fn->begin();
177 llvm::Instruction *ThisStore =
178 std::find_if(EntryBB->begin(), EntryBB->end(), [&](llvm::Instruction &I) {
179 return isa<llvm::StoreInst>(I) && I.getOperand(0) == ThisPtr;
181 assert(ThisStore &&
"Store of this should be in entry block?");
183 Builder.SetInsertPoint(ThisStore);
186 ThisStore->setOperand(0, AdjustedThisPtr);
190 for (llvm::Function::iterator I = Fn->begin(), E = Fn->end(); I != E; I++) {
191 llvm::Instruction *T = I->getTerminator();
192 if (isa<llvm::ReturnInst>(T)) {
194 T->eraseFromParent();
229 if (isa<CXXDestructorDecl>(MD))
238 CXXThisValue = CXXABIThisValue;
244 "Please use a new CGF for this thunk");
258 MD,
"non-trivial argument copy for return-adjusting thunk");
269 if (isa<CXXDestructorDecl>(MD))
285 assert(isa<CXXDestructorDecl>(MD) ||
286 similar(CallFnInfo.getReturnInfo(), CallFnInfo.getReturnType(),
290 assert(
similar(CallFnInfo.arg_begin()[i].info,
291 CallFnInfo.arg_begin()[i].type,
309 llvm::Instruction *CallOrInvoke;
334 for (llvm::Argument &A :
CurFn->args())
342 llvm::Type *ThisType = Args[ThisArgNo]->getType();
343 if (ThisType != AdjustedThisPtr->getType())
344 AdjustedThisPtr =
Builder.CreateBitCast(AdjustedThisPtr, ThisType);
345 Args[ThisArgNo] = AdjustedThisPtr;
347 assert(ThisAI.
isInAlloca() &&
"this is passed directly or inalloca");
349 llvm::Type *ThisType =
351 if (ThisType != AdjustedThisPtr->getType())
352 AdjustedThisPtr =
Builder.CreateBitCast(AdjustedThisPtr, ThisType);
353 Builder.CreateStore(AdjustedThisPtr, ThisAddr);
358 llvm::CallInst *Call =
Builder.CreateCall(Callee, Args);
359 Call->setTailCallKind(llvm::CallInst::TCK_MustTail);
366 llvm::AttributeSet Attrs =
368 Call->setAttributes(Attrs);
369 Call->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
371 if (Call->getType()->isVoidTy())
402 llvm::GlobalValue *Entry;
405 if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(C)) {
406 assert(CE->getOpcode() == llvm::Instruction::BitCast);
407 Entry = cast<llvm::GlobalValue>(CE->getOperand(0));
409 Entry = cast<llvm::GlobalValue>(
C);
414 if (Entry->getType()->getElementType() !=
416 llvm::GlobalValue *OldThunkFn = Entry;
419 assert(OldThunkFn->isDeclaration() &&
420 "Shouldn't replace non-declaration");
423 OldThunkFn->setName(StringRef());
427 if (!OldThunkFn->use_empty()) {
428 llvm::Constant *NewPtrForOldDecl =
429 llvm::ConstantExpr::getBitCast(Entry, OldThunkFn->getType());
430 OldThunkFn->replaceAllUsesWith(NewPtrForOldDecl);
434 OldThunkFn->eraseFromParent();
437 llvm::Function *ThunkFn = cast<llvm::Function>(Entry);
439 bool UseAvailableExternallyLinkage = ForVTable && ABIHasKeyFunctions;
441 if (!ThunkFn->isDeclaration()) {
442 if (!ABIHasKeyFunctions || UseAvailableExternallyLinkage) {
453 if (ThunkFn->isVarArg()) {
459 if (UseAvailableExternallyLinkage)
471 void CodeGenVTables::maybeEmitThunkForVTable(
GlobalDecl GD,
487 emitThunk(GD, Thunk,
true);
493 cast<CXXMethodDecl>(GD.
getDecl())->getCanonicalDecl();
502 if (!ThunkInfoVector)
505 for (
unsigned I = 0, E = ThunkInfoVector->size(); I != E; ++I)
506 emitThunk(GD, (*ThunkInfoVector)[I],
false);
512 unsigned NumVTableThunks, llvm::Constant *RTTI) {
517 llvm::Type *PtrDiffTy =
520 unsigned NextVTableThunkIndex = 0;
522 llvm::Constant *PureVirtualFn =
nullptr, *DeletedVirtualFn =
nullptr;
524 for (
unsigned I = 0; I != NumComponents; ++I) {
527 llvm::Constant *Init =
nullptr;
531 Init = llvm::ConstantInt::get(PtrDiffTy,
533 Init = llvm::ConstantExpr::getIntToPtr(Init, Int8PtrTy);
536 Init = llvm::ConstantInt::get(PtrDiffTy,
538 Init = llvm::ConstantExpr::getIntToPtr(Init, Int8PtrTy);
541 Init = llvm::ConstantInt::get(PtrDiffTy,
543 Init = llvm::ConstantExpr::getIntToPtr(Init, Int8PtrTy);
546 Init = llvm::ConstantExpr::getBitCast(RTTI, Int8PtrTy);
556 llvm_unreachable(
"Unexpected vtable component kind");
568 if (cast<CXXMethodDecl>(GD.
getDecl())->isPure()) {
570 if (!PureVirtualFn) {
571 llvm::FunctionType *Ty =
572 llvm::FunctionType::get(CGM.
VoidTy,
false);
575 PureVirtualFn = llvm::ConstantExpr::getBitCast(PureVirtualFn,
578 Init = PureVirtualFn;
579 }
else if (cast<CXXMethodDecl>(GD.
getDecl())->isDeleted()) {
580 if (!DeletedVirtualFn) {
581 llvm::FunctionType *Ty =
582 llvm::FunctionType::get(CGM.
VoidTy,
false);
583 StringRef DeletedCallName =
586 DeletedVirtualFn = llvm::ConstantExpr::getBitCast(DeletedVirtualFn,
589 Init = DeletedVirtualFn;
592 if (NextVTableThunkIndex < NumVTableThunks &&
593 VTableThunks[NextVTableThunkIndex].first == I) {
594 const ThunkInfo &Thunk = VTableThunks[NextVTableThunkIndex].second;
596 maybeEmitThunkForVTable(GD, Thunk);
599 NextVTableThunkIndex++;
606 Init = llvm::ConstantExpr::getBitCast(Init, Int8PtrTy);
612 Init = llvm::ConstantExpr::getNullValue(Int8PtrTy);
616 Inits.push_back(Init);
619 llvm::ArrayType *
ArrayType = llvm::ArrayType::get(Int8PtrTy, NumComponents);
620 return llvm::ConstantArray::get(ArrayType, Inits);
623 llvm::GlobalVariable *
627 llvm::GlobalVariable::LinkageTypes
Linkage,
628 VTableAddressPointsMapTy& AddressPoints) {
630 DI->completeClassData(Base.
getBase());
632 std::unique_ptr<VTableLayout> VTLayout(
637 AddressPoints = VTLayout->getAddressPoints();
641 llvm::raw_svector_ostream Out(OutName);
646 StringRef Name = OutName.str();
649 llvm::ArrayType::get(CGM.
Int8PtrTy, VTLayout->getNumVTableComponents());
656 if (Linkage == llvm::GlobalVariable::AvailableExternallyLinkage)
660 llvm::GlobalVariable *VTable =
665 VTable->setUnnamedAddr(
true);
672 Base.
getBase(), VTLayout->vtable_component_begin(),
673 VTLayout->getNumVTableComponents(), VTLayout->vtable_thunk_begin(),
674 VTLayout->getNumVTableThunks(), RTTI);
675 VTable->setInitializer(Init);
685 llvm::GlobalVariable::LinkageTypes
693 if (keyFunction && !RD->
hasAttr<DLLImportAttr>()) {
698 keyFunction = cast<CXXMethodDecl>(def);
703 assert(def &&
"Should not have been asked to emit this");
706 llvm::GlobalVariable::LinkOnceODRLinkage :
713 llvm::GlobalVariable::LinkOnceODRLinkage :
718 llvm::GlobalVariable::WeakODRLinkage :
722 llvm_unreachable(
"Should not have been asked to emit this");
731 llvm::GlobalVariable::LinkageTypes DiscardableODRLinkage =
732 llvm::GlobalValue::LinkOnceODRLinkage;
733 llvm::GlobalVariable::LinkageTypes NonDiscardableODRLinkage =
734 llvm::GlobalValue::WeakODRLinkage;
735 if (RD->
hasAttr<DLLExportAttr>()) {
737 DiscardableODRLinkage = NonDiscardableODRLinkage;
738 }
else if (RD->
hasAttr<DLLImportAttr>()) {
740 DiscardableODRLinkage = llvm::GlobalVariable::AvailableExternallyLinkage;
741 NonDiscardableODRLinkage = llvm::GlobalVariable::AvailableExternallyLinkage;
748 return DiscardableODRLinkage;
754 return NonDiscardableODRLinkage;
757 llvm_unreachable(
"Invalid TemplateSpecializationKind!");
773 DI->completeClassData(RD);
792 assert(RD->
isDynamicClass() &&
"Non-dynamic classes have no VTable.");
814 return !keyFunction->
hasBody();
828 void CodeGenModule::EmitDeferredVTables() {
832 size_t savedSize = DeferredVTables.size();
835 typedef std::vector<const CXXRecordDecl *>::const_iterator const_iterator;
836 for (const_iterator i = DeferredVTables.begin(),
837 e = DeferredVTables.end(); i != e; ++i) {
843 assert(savedSize == DeferredVTables.size() &&
844 "deferred extra v-tables during v-table emission?");
845 DeferredVTables.clear();
855 if (!LangOpts.
Sanitize.
has(SanitizerKind::CFIVCall) &&
856 !LangOpts.
Sanitize.
has(SanitizerKind::CFINVCall) &&
857 !LangOpts.
Sanitize.
has(SanitizerKind::CFIDerivedCast) &&
858 !LangOpts.
Sanitize.
has(SanitizerKind::CFIUnrelatedCast))
864 std::vector<llvm::MDTuple *> BitsetEntries;
871 VTable, PointerWidth * AP.second, AP.first.getBase()));
875 std::sort(BitsetEntries.begin(), BitsetEntries.end(), [](llvm::MDTuple *T1,
880 StringRef S1 = cast<llvm::MDString>(T1->getOperand(0))->getString();
881 StringRef S2 = cast<llvm::MDString>(T2->getOperand(0))->getString();
887 uint64_t Offset1 = cast<llvm::ConstantInt>(
888 cast<llvm::ConstantAsMetadata>(T1->getOperand(2))
890 uint64_t Offset2 = cast<llvm::ConstantInt>(
891 cast<llvm::ConstantAsMetadata>(T2->getOperand(2))
893 assert(Offset1 != Offset2);
894 return Offset1 < Offset2;
897 llvm::NamedMDNode *BitsetsMD =
898 getModule().getOrInsertNamedMetadata(
"llvm.bitsets");
899 for (
auto BitsetEntry : BitsetEntries)
900 BitsetsMD->addOperand(BitsetEntry);
External linkage, which indicates that the entity can be referred to from other translation units...
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)
Return true iff the given type uses 'sret' when used as a return type.
CodeGenTypes & getTypes()
CanQualType getReturnType() const
CharUnits getOffsetToTop() const
virtual void EmitReturnFromThunk(CodeGenFunction &CGF, RValue RV, QualType ResultType)
llvm::Module & getModule() const
virtual void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy, FunctionArgList &Params)=0
SanitizerSet Sanitize
Set of enabled sanitizers.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
virtual const ThunkInfoVectorTy * getThunkInfo(GlobalDecl GD)
llvm::Value * LoadCXXThis()
bool isInStdNamespace() const
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
virtual StringRef GetDeletedVirtualCallName()=0
Gets the deleted virtual member call name.
llvm::Function * GenerateVarArgsThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk)
bool isFuncTypeConvertible(const FunctionType *FT)
virtual llvm::Value * performThisAdjustment(CodeGenFunction &CGF, llvm::Value *This, const ThisAdjustment &TA)=0
CGDebugInfo * getModuleDebugInfo()
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
llvm::Value * ReturnValue
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
virtual llvm::Value * performReturnAdjustment(CodeGenFunction &CGF, llvm::Value *Ret, const ReturnAdjustment &RA)=0
virtual bool hasMostDerivedReturn(GlobalDecl GD) const
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body (definition). The function body might be in any of the (re-)d...
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
static void setThunkVisibility(CodeGenModule &CGM, const CXXMethodDecl *MD, const ThunkInfo &Thunk, llvm::Function *Fn)
bool isReferenceType() const
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
const Decl * getDecl() const
virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF)=0
Emit the ABI-specific prolog for the function.
const CXXMethodDecl * getFunctionDecl() const
static bool hasScalarEvaluationKind(QualType T)
RValue EmitCall(const CGFunctionInfo &FnInfo, llvm::Value *Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, const Decl *TargetDecl=nullptr, llvm::Instruction **callOrInvoke=nullptr)
const TargetInfo & getTargetInfo() const
virtual void emitVTableDefinitions(CodeGenVTables &CGVT, const CXXRecordDecl *RD)=0
Emits the VTable definitions required for the given record type.
const LangOptions & getLangOpts() const
CharUnits getVCallOffset() const
QualType getReturnType() const
unsigned getCallingConvention() const
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
ItaniumVTableContext & getItaniumVTableContext()
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const
Set the visibility for the given LLVM GlobalValue.
const CGFunctionInfo & arrangeGlobalDeclaration(GlobalDecl GD)
param_iterator param_begin()
const TargetInfo & getTarget() const
void EmitDelegateCallArg(CallArgList &args, const VarDecl *param, SourceLocation loc)
bool isVTableExternal(const CXXRecordDecl *RD)
const CXXRecordDecl * getBase() const
getBase - Returns the base class declaration.
static void setThunkProperties(CodeGenModule &CGM, const ThunkInfo &Thunk, llvm::Function *ThunkFn, bool ForVTable, GlobalDecl GD)
static bool similar(const ABIArgInfo &infoL, CanQualType typeL, const ABIArgInfo &infoR, CanQualType typeR)
CXXDtorType getDtorType() const
CGCXXABI & getCXXABI() const
llvm::Value * GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
bool usesInAlloca() const
Return true if this function uses inalloca arguments.
Inits[]
Gets the list of initial values for linear variables.
Represents a C++ destructor within a class.
virtual StringRef GetPureVirtualCallName()=0
Gets the pure virtual member call function.
ASTContext & getContext() const
void add(RValue rvalue, QualType type, bool needscopy=false)
static SVal getValue(SVal val, SValBuilder &svalBuilder)
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
llvm::LLVMContext & getLLVMContext()
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
bool hasKeyFunctions() const
Does this ABI use key functions? If so, class data such as the vtable is emitted with strong linkage ...
virtual bool HasThisReturn(GlobalDecl GD) const
bool isExternallyVisible() const
unsigned getRegParm() const
virtual void adjustCallArgsForDestructorThunk(CodeGenFunction &CGF, GlobalDecl GD, CallArgList &CallArgs)
void generateThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk)
Generate a thunk for the given method.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage)
llvm::Constant * GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk)
Get the address of the thunk for the given global decl.
virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &ThisAdjustment, raw_ostream &)=0
llvm::Constant * CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeSet ExtraAttrs=llvm::AttributeSet())
Create a new runtime function with the specified type and name.
ASTContext & getContext() const
void EmitCallAndReturnForThunk(llvm::Value *Callee, const ThunkInfo *Thunk)
Represents a single component in a vtable.
Represents a static or instance method of a struct/union/class.
llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)
Get the address of the RTTI descriptor for the given type.
CodeGenVTables(CodeGenModule &CGM)
const CXXDestructorDecl * getDestructorDecl() const
const CodeGenOptions & getCodeGenOpts() const
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, const CGFunctionInfo &FnInfo, const FunctionArgList &Args, SourceLocation Loc=SourceLocation(), SourceLocation StartLoc=SourceLocation())
Emit code for the start of a function.
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
virtual void emitVirtualInheritanceTables(const CXXRecordDecl *RD)=0
llvm::MDTuple * CreateVTableBitSetEntry(llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)
Create a bitset entry for the given vtable.
MangleContext & getMangleContext()
Gets the mangle context.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
const CGFunctionInfo & arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type, RequiredArgs required)
Arrange a call to a C++ method, passing the given arguments.
const CGFunctionInfo * CurFnInfo
bool isDynamicClass() const
llvm::GlobalVariable * GenerateConstructionVTable(const CXXRecordDecl *RD, const BaseSubobject &Base, bool BaseIsVirtual, llvm::GlobalVariable::LinkageTypes Linkage, VTableAddressPointsMapTy &AddressPoints)
void FinishFunction(SourceLocation EndLoc=SourceLocation())
bool isSRetAfterThis() const
void EmitVTableBitSetEntries(llvm::GlobalVariable *VTable, const VTableLayout &VTLayout)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
static const Type * getElementType(const Expr *BaseExpr)
ThisAdjustment This
The this pointer adjustment.
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=0, bool ForVTable=false, bool DontDefer=false)
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
void ConstructAttributeList(const CGFunctionInfo &Info, const Decl *TargetDecl, AttributeListType &PAL, unsigned &CallingConv, bool AttrOnCallSite)
CharUnits getVBaseOffset() const
void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params)
Build a parameter variable suitable for 'this'.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
void EmitThunks(GlobalDecl GD)
EmitThunks - Emit the associated thunks for the given global decl.
param_iterator param_end()
llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, unsigned additional)
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
llvm::PointerType * Int8PtrTy
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
static bool shouldEmitVTableAtEndOfTranslationUnit(CodeGenModule &CGM, const CXXRecordDecl *RD)
void GenerateClassData(const CXXRecordDecl *RD)
ReturnAdjustment Return
The return adjustment.
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
ABIArgInfo & getReturnInfo()
void StartThunk(llvm::Function *Fn, GlobalDecl GD, const CGFunctionInfo &FnInfo)
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
llvm::Type * GetFunctionTypeForVTable(GlobalDecl GD)
static RValue PerformReturnAdjustment(CodeGenFunction &CGF, QualType ResultType, RValue RV, const ThunkInfo &Thunk)
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or NULL if there isn't one...
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool IsCFIBlacklistedRecord(const CXXRecordDecl *RD)
virtual void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, raw_ostream &)=0
llvm::Constant * CreateVTableInitializer(const CXXRecordDecl *RD, const VTableComponent *Components, unsigned NumComponents, const VTableLayout::VTableThunkTy *VTableThunks, unsigned NumVTableThunks, llvm::Constant *RTTI)
std::pair< uint64_t, ThunkInfo > VTableThunkTy
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
const_arg_iterator arg_begin() const
A pointer to the deleting destructor.
static RValue get(llvm::Value *V)
unsigned arg_size() const
Kind getKind() const
Get the kind of this vtable component.
const AddressPointsMapTy & getAddressPoints() const
CodeGenVTables & getVTables()
CharUnits getBaseOffset() const
getBaseOffset - Returns the base class offset.
SourceLocation getLocation() const
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
A pointer to the complete destructor.
An entry that is never used.
virtual void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, bool ReturnAdjustment)=0
bool supportsCOMDAT() const
void EmitVTable(CXXRecordDecl *Class)
void EmitMustTailThunk(const CXXMethodDecl *MD, llvm::Value *AdjustedThisPtr, llvm::Value *Callee)
Emit a musttail call for a thunk with a potentially adjusted this pointer.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.