diff options
| author | Timur Iskhodzhanov <timurrrr@google.com> | 2013-07-30 09:46:19 +0000 |
|---|---|---|
| committer | Timur Iskhodzhanov <timurrrr@google.com> | 2013-07-30 09:46:19 +0000 |
| commit | 635de28950ef84ae26308ff734e778bad1ddde92 (patch) | |
| tree | 633d12b6de7f5705fbca6b3b60eb67c971666ae0 /lib/CodeGen/CGVTables.cpp | |
| parent | 878d0cc54944ef5af42826518c40e46381df6f69 (diff) | |
| download | clang-635de28950ef84ae26308ff734e778bad1ddde92.tar.gz clang-635de28950ef84ae26308ff734e778bad1ddde92.tar.bz2 clang-635de28950ef84ae26308ff734e778bad1ddde92.tar.xz | |
Add MicrosoftVFTableContext to AST
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
| -rw-r--r-- | lib/CodeGen/CGVTables.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 9c4a5e0cda..c7bb54e069 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -29,7 +29,14 @@ using namespace clang; using namespace CodeGen; CodeGenVTables::CodeGenVTables(CodeGenModule &CGM) - : CGM(CGM), VTContext(CGM.getContext()) { } + : CGM(CGM), VTContext(CGM.getContext()) { + if (CGM.getTarget().getCXXABI().isMicrosoft()) { + // FIXME: Eventually, we should only have one of V*TContexts available. + // Today we use both in the Microsoft ABI as MicrosoftVFTableContext + // is not completely supported in CodeGen yet. + VFTContext.reset(new MicrosoftVFTableContext(CGM.getContext())); + } +} llvm::Constant *CodeGenModule::GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk) { @@ -389,6 +396,11 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk, bool UseAvailableExternallyLinkage) { + if (CGM.getTarget().getCXXABI().isMicrosoft()) { + // Emission of thunks is not supported yet in Microsoft ABI. + return; + } + const CGFunctionInfo &FnInfo = CGM.getTypes().arrangeGlobalDeclaration(GD); // FIXME: re-use FnInfo in this computation. @@ -485,6 +497,12 @@ void CodeGenVTables::EmitThunks(GlobalDecl GD) if (isa<CXXDestructorDecl>(MD) && GD.getDtorType() == Dtor_Base) return; + if (VFTContext.isValid()) { + // FIXME: This is a temporary solution to force generation of vftables in + // Microsoft ABI. Remove when we thread VFTableContext through CodeGen. + VFTContext->getVFPtrOffsets(MD->getParent()); + } + const VTableContext::ThunkInfoVectorTy *ThunkInfoVector = VTContext.getThunkInfo(MD); if (!ThunkInfoVector) @@ -804,6 +822,12 @@ void CodeGenModule::EmitVTable(CXXRecordDecl *theClass, bool isRequired) { void CodeGenVTables::GenerateClassData(const CXXRecordDecl *RD) { + if (VFTContext.isValid()) { + // FIXME: This is a temporary solution to force generation of vftables in + // Microsoft ABI. Remove when we thread VFTableContext through CodeGen. + VFTContext->getVFPtrOffsets(RD); + } + // First off, check whether we've already emitted the v-table and // associated stuff. llvm::GlobalVariable *VTable = GetAddrOfVTable(RD); |
