[cfe-commits] r166847 - /cfe/trunk/lib/CodeGen/CGExpr.cpp

Rafael Espindola rafael.espindola at gmail.com
Fri Oct 26 17:36:38 PDT 2012


Author: rafael
Date: Fri Oct 26 19:36:38 2012
New Revision: 166847

URL: http://llvm.org/viewvc/llvm-project?rev=166847&view=rev
Log:
Delay codegen to after collecting all SubobjectAdjustment so that the collection
can be refactored and used in Sema.

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

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=166847&r1=166846&r2=166847&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Oct 26 19:36:38 2012
@@ -177,7 +177,7 @@
 
       struct {
         const MemberPointerType *MPT;
-        llvm::Value *Ptr;
+        Expr *RHS;
       } Ptr;
     };
 
@@ -193,10 +193,10 @@
       this->Field = Field;
     }
 
-    SubobjectAdjustment(const MemberPointerType *MPT, llvm::Value *Ptr)
+    SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
       : Kind(MemberPointerAdjustment) {
       this->Ptr.MPT = MPT;
-      this->Ptr.Ptr = Ptr;
+      this->Ptr.RHS = RHS;
     }
   };
 }
@@ -371,8 +371,7 @@
           E = BO->getLHS();
           const MemberPointerType *MPT =
               BO->getRHS()->getType()->getAs<MemberPointerType>();
-          llvm::Value *Ptr = CGF.EmitScalarExpr(BO->getRHS());
-          Adjustments.push_back(SubobjectAdjustment(MPT, Ptr));
+          Adjustments.push_back(SubobjectAdjustment(MPT, BO->getRHS()));
         }
       }
 
@@ -447,8 +446,9 @@
         }
 
         case SubobjectAdjustment::MemberPointerAdjustment: {
+          llvm::Value *Ptr = CGF.EmitScalarExpr(Adjustment.Ptr.RHS);
           Object = CGF.CGM.getCXXABI().EmitMemberDataPointerAddress(
-                        CGF, Object, Adjustment.Ptr.Ptr, Adjustment.Ptr.MPT);
+                        CGF, Object, Ptr, Adjustment.Ptr.MPT);
           break;
         }
         }





More information about the cfe-commits mailing list