[cfe-commits] r78875 - /cfe/trunk/lib/CodeGen/CGCXX.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Aug 12 17:53:36 PDT 2009


Author: fjahanian
Date: Wed Aug 12 19:53:36 2009
New Revision: 78875

URL: http://llvm.org/viewvc/llvm-project?rev=78875&view=rev
Log:
Minor refactoring of copy assign operator ir-gen. SWIP.


Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=78875&r1=78874&r2=78875&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Aug 12 19:53:36 2009
@@ -840,26 +840,29 @@
   }
   
   const CXXMethodDecl *MD = 0;
-  if (BaseClassDecl->hasConstCopyAssignment(getContext(), MD)) {
-    const FunctionProtoType *FPT = MD->getType()->getAsFunctionProtoType();
-    const llvm::Type *Ty = 
-      CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), 
-                                     FPT->isVariadic());
-    llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty);
+  bool ConstCopyAssignOp = BaseClassDecl->hasConstCopyAssignment(getContext(), 
+                                                                 MD);
+  assert(ConstCopyAssignOp && "EmitClassCopyAssignment - missing copy assign");
+  (void)ConstCopyAssignOp;
+
+  const FunctionProtoType *FPT = MD->getType()->getAsFunctionProtoType();
+  const llvm::Type *LTy = 
+    CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), 
+                                   FPT->isVariadic());
+  llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), LTy);
     
-    CallArgList CallArgs;
-    // Push the this (Dest) ptr.
-    CallArgs.push_back(std::make_pair(RValue::get(Dest),
-                                      MD->getThisType(getContext())));
+  CallArgList CallArgs;
+  // Push the this (Dest) ptr.
+  CallArgs.push_back(std::make_pair(RValue::get(Dest),
+                                    MD->getThisType(getContext())));
     
-    // Push the Src ptr.
-    CallArgs.push_back(std::make_pair(RValue::get(Src),
-                                      MD->getParamDecl(0)->getType()));
-    QualType ResultType = 
-      MD->getType()->getAsFunctionType()->getResultType();
-    EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
-             Callee, CallArgs, MD);
-  }
+  // Push the Src ptr.
+  CallArgs.push_back(std::make_pair(RValue::get(Src),
+                                    MD->getParamDecl(0)->getType()));
+  QualType ResultType = 
+    MD->getType()->getAsFunctionType()->getResultType();
+  EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
+           Callee, CallArgs, MD);
 }
 
 /// SynthesizeDefaultConstructor - synthesize a default constructor





More information about the cfe-commits mailing list