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

Daniel Dunbar daniel at zuster.org
Fri Aug 20 20:37:02 PDT 2010


Author: ddunbar
Date: Fri Aug 20 22:37:02 2010
New Revision: 111720

URL: http://llvm.org/viewvc/llvm-project?rev=111720&view=rev
Log:
IRgen: The CVR qualifiers in a subobject adjustment should just come from the
field (I think).
 - Doug, please check.

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=111720&r1=111719&r2=111720&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Aug 20 22:37:02 2010
@@ -146,10 +146,7 @@
       const CXXRecordDecl *DerivedClass;
     } DerivedToBase;
     
-    struct {
-      FieldDecl *Field;
-      unsigned CVRQualifiers;
-    } Field;
+    FieldDecl *Field;
   };
   
   SubobjectAdjustment(const CastExpr *BasePath, 
@@ -160,11 +157,10 @@
     DerivedToBase.DerivedClass = DerivedClass;
   }
   
-  SubobjectAdjustment(FieldDecl *Field, unsigned CVRQualifiers)
-    : Kind(FieldAdjustment) 
+  SubobjectAdjustment(FieldDecl *Field)
+    : Kind(FieldAdjustment)
   { 
-    this->Field.Field = Field;
-    this->Field.CVRQualifiers = CVRQualifiers;
+    this->Field = Field;
   }
 };
 
@@ -249,8 +245,7 @@
             ME->getBase()->getType()->isRecordType()) {
           if (FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
             E = ME->getBase();
-            Adjustments.push_back(SubobjectAdjustment(Field,
-                                              E->getType().getCVRQualifiers()));
+            Adjustments.push_back(SubobjectAdjustment(Field));
             continue;
           }
         }
@@ -296,9 +291,8 @@
           break;
             
         case SubobjectAdjustment::FieldAdjustment: {
-          unsigned CVR = Adjustment.Field.CVRQualifiers;
           LValue LV = 
-            CGF.EmitLValueForField(Object, Adjustment.Field.Field, CVR);
+            CGF.EmitLValueForField(Object, Adjustment.Field, 0);
           if (LV.isSimple()) {
             Object = LV.getAddress();
             break;
@@ -306,11 +300,11 @@
           
           // For non-simple lvalues, we actually have to create a copy of
           // the object we're binding to.
-          QualType T = Adjustment.Field.Field->getType().getNonReferenceType()
-                                                        .getUnqualifiedType();
+          QualType T = Adjustment.Field->getType().getNonReferenceType()
+                                                  .getUnqualifiedType();
           Object = CreateReferenceTemporary(CGF, T, InitializedDecl);
-          LValue TempLV = LValue::MakeAddr(Object, 
-                                           Qualifiers::fromCVRMask(CVR));
+          LValue TempLV = CGF.MakeAddrLValue(Object,
+                                             Adjustment.Field->getType());
           CGF.EmitStoreThroughLValue(CGF.EmitLoadOfLValue(LV, T), TempLV, T);
           break;
         }





More information about the cfe-commits mailing list