diff options
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index bd12c4a..f21350d 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -22,7 +22,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ValueHandle.h" -#include <map> #include "CodeGenModule.h" #include "CGBlocks.h" #include "CGBuilder.h" @@ -254,6 +253,27 @@ public: } }; + /// CXXTemporariesCleanupScope - Enters a new scope for catching live + /// temporaries, all of which will be popped once the scope is exited. + class CXXTemporariesCleanupScope { + CodeGenFunction &CGF; + size_t NumLiveTemporaries; + + // DO NOT IMPLEMENT + CXXTemporariesCleanupScope(const CXXTemporariesCleanupScope &); + CXXTemporariesCleanupScope &operator=(const CXXTemporariesCleanupScope &); + + public: + explicit CXXTemporariesCleanupScope(CodeGenFunction &CGF) + : CGF(CGF), NumLiveTemporaries(CGF.LiveTemporaries.size()) { } + + ~CXXTemporariesCleanupScope() { + while (CGF.LiveTemporaries.size() > NumLiveTemporaries) + CGF.PopCXXTemporary(); + } + }; + + /// EmitCleanupBlocks - Takes the old cleanup stack size and emits the cleanup /// blocks that have been added. void EmitCleanupBlocks(size_t OldCleanupStackSize); @@ -504,30 +524,29 @@ public: /// legal to call this function even if there is no current insertion point. void FinishFunction(SourceLocation EndLoc=SourceLocation()); - /// DynamicTypeAdjust - Do the non-virtual and virtual adjustments on an - /// object pointer to alter the dynamic type of the pointer. Used by - /// GenerateCovariantThunk for building thunks. - llvm::Value *DynamicTypeAdjust(llvm::Value *V, - const ThunkAdjustment &Adjustment); - - /// GenerateThunk - Generate a thunk for the given method - llvm::Constant *GenerateThunk(llvm::Function *Fn, GlobalDecl GD, - bool Extern, - const ThunkAdjustment &ThisAdjustment); - llvm::Constant * - GenerateCovariantThunk(llvm::Function *Fn, GlobalDecl GD, - bool Extern, - const CovariantThunkAdjustment &Adjustment); - + /// GenerateThunk - Generate a thunk for the given method. + void GenerateThunk(llvm::Function *Fn, GlobalDecl GD, const ThunkInfo &Thunk); + void EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType Type); - void InitializeVtablePtrs(const CXXRecordDecl *ClassDecl); + /// InitializeVTablePointer - Initialize the vtable pointer of the given + /// subobject. + /// + /// \param BaseIsMorallyVirtual - Whether the base subobject is a virtual base + /// or a direct or indirect base of a virtual base. + void InitializeVTablePointer(BaseSubobject Base, bool BaseIsMorallyVirtual, + llvm::Constant *VTable, + const CXXRecordDecl *VTableClass); + + typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy; + void InitializeVTablePointers(BaseSubobject Base, bool BaseIsMorallyVirtual, + bool BaseIsNonVirtualPrimaryBase, + llvm::Constant *VTable, + const CXXRecordDecl *VTableClass, + VisitedVirtualBasesSetTy& VBases); + + void InitializeVTablePointers(const CXXRecordDecl *ClassDecl); - void InitializeVtablePtrsRecursive(const CXXRecordDecl *ClassDecl, - llvm::Constant *Vtable, - CGVtableInfo::AddrSubMap_t& AddressPoints, - llvm::Value *ThisPtr, - uint64_t Offset); void SynthesizeCXXCopyConstructor(const FunctionArgList &Args); void SynthesizeCXXCopyAssignment(const FunctionArgList &Args); @@ -1272,6 +1291,10 @@ public: /// getTrapBB - Create a basic block that will call the trap intrinsic. We'll /// generate a branch around the created basic block as necessary. llvm::BasicBlock* getTrapBB(); + + /// EmitCallArg - Emit a single call argument. + RValue EmitCallArg(const Expr *E, QualType ArgType); + private: void EmitReturnOfRValue(RValue RV, QualType Ty); @@ -1303,9 +1326,6 @@ private: /// current cleanup scope. void AddBranchFixup(llvm::BranchInst *BI); - /// EmitCallArg - Emit a single call argument. - RValue EmitCallArg(const Expr *E, QualType ArgType); - /// EmitCallArgs - Emit call arguments for a function. /// The CallArgTypeInfo parameter is used for iterating over the known /// argument types of the function being called. |