diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-03 19:27:17 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-03 19:27:17 +0000 |
commit | 7f6f81ba9bb6d9b762e51a70081f11904fcaa027 (patch) | |
tree | 5e525f03b122deca3441d11e3eefc77aae415b21 /clang/lib/CodeGen/CGCXX.cpp | |
parent | ff885ce667385ed9573bc641a6e1a058948e14d9 (diff) | |
download | llvm-7f6f81ba9bb6d9b762e51a70081f11904fcaa027.zip llvm-7f6f81ba9bb6d9b762e51a70081f11904fcaa027.tar.gz llvm-7f6f81ba9bb6d9b762e51a70081f11904fcaa027.tar.bz2 |
Clean up of -fapple-kext abi code. No change otherwise.
llvm-svn: 124807
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index a414567..9cb8595 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -312,7 +312,6 @@ CodeGenFunction::BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This, llvm::Value * CodeGenFunction::BuildAppleKextVirtualCall(const CXXMethodDecl *MD, NestedNameSpecifier *Qual, - llvm::Value *This, const llvm::Type *Ty) { llvm::Value *VTable = 0; assert((Qual->getKind() == NestedNameSpecifier::TypeSpec) && @@ -354,7 +353,6 @@ CodeGenFunction::BuildAppleKextVirtualDestructorCall( // It need be somehow inline expanded into the caller. // -O does that. But need to support -O0 as well. if (MD->isVirtual() && Type != Dtor_Base) { - DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl()); // Compute the function type we're calling. const CGFunctionInfo *FInfo = &CGM.getTypes().getFunctionInfo(cast<CXXDestructorDecl>(MD), @@ -362,18 +360,18 @@ CodeGenFunction::BuildAppleKextVirtualDestructorCall( const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); const llvm::Type *Ty = CGM.getTypes().GetFunctionType(*FInfo, FPT->isVariadic()); - if (!RD) - RD = DD->getParent(); + llvm::Value *VTable = CGM.getVTables().GetAddrOfVTable(RD); Ty = Ty->getPointerTo()->getPointerTo(); VTable = Builder.CreateBitCast(VTable, Ty); + DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl()); uint64_t VTableIndex = - CGM.getVTables().getMethodVTableIndex(GlobalDecl(DD, Type)); + CGM.getVTables().getMethodVTableIndex(GlobalDecl(DD, Type)); uint64_t AddressPoint = - CGM.getVTables().getAddressPoint(BaseSubobject(RD, 0), RD); + CGM.getVTables().getAddressPoint(BaseSubobject(RD, 0), RD); VTableIndex += AddressPoint; llvm::Value *VFuncPtr = - CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt"); + CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt"); Callee = CGF.Builder.CreateLoad(VFuncPtr); } return Callee; |