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

Eli Friedman eli.friedman at gmail.com
Sun Nov 15 21:48:01 PST 2009


Author: efriedma
Date: Sun Nov 15 23:48:01 2009
New Revision: 88894

URL: http://llvm.org/viewvc/llvm-project?rev=88894&view=rev
Log:
Some minor cleanup for EmitCastLValue.


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=88894&r1=88893&r2=88894&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sun Nov 15 23:48:01 2009
@@ -1298,14 +1298,8 @@
 LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
   switch (E->getCastKind()) {
   default:
-    // If this is an lvalue cast, treat it as a no-op.
-    // FIXME: We shouldn't need to check for this explicitly!
-    if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
-      if (ICE->isLvalueCast())
-        return EmitLValue(E->getSubExpr());
-    
-    assert(false && "Unhandled cast!");
-      
+    return EmitUnsupportedLValue(E, "unexpected cast lvalue");
+
   case CastExpr::CK_NoOp:
   case CastExpr::CK_ConstructorConversion:
   case CastExpr::CK_UserDefinedConversion:
@@ -1335,16 +1329,18 @@
 
     return LValue::MakeAddr(Temp, MakeQualifiers(E->getType()));
   }
+  case CastExpr::CK_BaseToDerived: {
+    return EmitUnsupportedLValue(E, "base-to-derived cast lvalue");
+  }
   case CastExpr::CK_BitCast: {
-    // This must be a reinterpret_cast.
-    const CXXReinterpretCastExpr *CE = cast<CXXReinterpretCastExpr>(E);
+    // This must be a reinterpret_cast (or c-style equivalent).
+    const ExplicitCastExpr *CE = cast<ExplicitCastExpr>(E);
     
     LValue LV = EmitLValue(E->getSubExpr());
     llvm::Value *V = Builder.CreateBitCast(LV.getAddress(),
                                            ConvertType(CE->getTypeAsWritten()));
     return LValue::MakeAddr(V, MakeQualifiers(E->getType()));
   }
-
   }
 }
 





More information about the cfe-commits mailing list