]> granicus.if.org Git - clang/commitdiff
Clean up of -fapple-kext abi code. No change otherwise.
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 3 Feb 2011 19:27:17 +0000 (19:27 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 3 Feb 2011 19:27:17 +0000 (19:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124807 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGClass.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CodeGenFunction.h

index a4145675b3e064ab615b04816e17f8bf4e0dca44..9cb85954dfbd003f0f8a6042ab607e5ffb603a1e 100644 (file)
@@ -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;
index 905e16815009ef70092caab2b08a49f65832e89a..ac2a5445a49dff07c99dffa046fd046849545b1b 100644 (file)
@@ -1270,7 +1270,8 @@ void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
                                      ForVirtualBase);
   llvm::Value *Callee = 0;
   if (getContext().getLangOptions().AppleKext)
-    Callee = BuildAppleKextVirtualDestructorCall(DD, Type);
+    Callee = BuildAppleKextVirtualDestructorCall(DD, Type, 
+                                                 DD->getParent());
     
   if (!Callee)
     Callee = CGM.GetAddrOfCXXDestructor(DD, Type);
index cd61f852830a49bed175513bba1bde2d5e979183..bd971af96d845b1973a92bd69567a885e184c0be 100644 (file)
@@ -228,7 +228,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
       if (getContext().getLangOptions().AppleKext &&
           MD->isVirtual() &&
           ME->hasQualifier())
-        Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), This, Ty);
+        Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty);
       else
         Callee = CGM.GetAddrOfFunction(GlobalDecl(Dtor, Dtor_Complete), Ty);
     }
@@ -241,7 +241,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
     if (getContext().getLangOptions().AppleKext &&
         MD->isVirtual() &&
         ME->hasQualifier())
-      Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), This, Ty);
+      Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty);
     else 
       Callee = CGM.GetAddrOfFunction(MD, Ty);
   }
index 5e91e0b1a52ac81ed2f17f2975592956011322b1..d1794d0089189917af994580c1b62d7c3e8b11b4 100644 (file)
@@ -1661,12 +1661,11 @@ public:
                                 llvm::Value *This, const llvm::Type *Ty);
   llvm::Value *BuildAppleKextVirtualCall(const CXXMethodDecl *MD, 
                                          NestedNameSpecifier *Qual,
-                                         llvm::Value *This,
                                          const llvm::Type *Ty);
   
   llvm::Value *BuildAppleKextVirtualDestructorCall(const CXXDestructorDecl *DD,
                                                    CXXDtorType Type, 
-                                                   const CXXRecordDecl *RD=0);
+                                                   const CXXRecordDecl *RD);
 
   RValue EmitCXXMemberCall(const CXXMethodDecl *MD,
                            llvm::Value *Callee,