diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-18 04:02:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-18 04:02:57 +0000 |
commit | 63d06ab65a9b6f3f2dced57345848adf289bdeb7 (patch) | |
tree | 1560f9d4ba2057cffd6d5a82b11c09d9ccfc2d60 /clang/lib/CodeGen | |
parent | dc78bd9f79960a9ef0589a7831248880305d826e (diff) | |
download | bcm5719-llvm-63d06ab65a9b6f3f2dced57345848adf289bdeb7.tar.gz bcm5719-llvm-63d06ab65a9b6f3f2dced57345848adf289bdeb7.zip |
teach codegen to handle noop casts as lvalues.
llvm-svn: 67164
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 3ab85686752..b3cf921bc57 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -179,6 +179,19 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { return EmitCompoundLiteralLValue(cast<CompoundLiteralExpr>(E)); case Expr::ChooseExprClass: return EmitLValue(cast<ChooseExpr>(E)->getChosenSubExpr(getContext())); + case Expr::ImplicitCastExprClass: + case Expr::CStyleCastExprClass: + case Expr::CXXFunctionalCastExprClass: + case Expr::CXXStaticCastExprClass: + case Expr::CXXDynamicCastExprClass: + case Expr::CXXReinterpretCastExprClass: + case Expr::CXXConstCastExprClass: + // Casts are only lvalues when the source and destination types are the + // same. + assert(getContext().hasSameUnqualifiedType(E->getType(), + cast<CastExpr>(E)->getSubExpr()->getType()) && + "Type changing cast is not an lvalue"); + return EmitLValue(cast<CastExpr>(E)->getSubExpr()); } } |