]> granicus.if.org Git - clang/commitdiff
Minor refactoring of my last patch.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 11 May 2010 16:31:10 +0000 (16:31 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 11 May 2010 16:31:10 +0000 (16:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103475 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index 8b8b65932b1548ee9b267cc08a1450ca9916753b..53794152a854fa36f22de4e3877b70070deaa87a 100644 (file)
@@ -1672,11 +1672,12 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
 
   case CastExpr::CK_NoOp: {
     LValue LV = EmitLValue(E->getSubExpr());
-    // FIXME. assign a meaningfull cast kind.
     if (LV.isPropertyRef()) {
-      RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getSubExpr()->getType());
-      llvm::Value *V = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
-      return LValue::MakeAddr(V, MakeQualifiers(E->getSubExpr()->getType()));
+      QualType QT = E->getSubExpr()->getType();
+      RValue RV = EmitLoadOfPropertyRefLValue(LV, QT);
+      assert(!RV.isScalar() && "EmitCastLValue - scalar cast of property ref");
+      llvm::Value *V = RV.getAggregateAddr();
+      return LValue::MakeAddr(V, MakeQualifiers(QT));
     }
     return LV;
   }