diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-06-17 23:00:29 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-06-17 23:00:29 +0000 |
| commit | 64cda8b5f3170ecc073d3ff2970e14c58234306c (patch) | |
| tree | 09074d4dc0918e89e50b4e071a57090639bc7647 /clang/lib/CodeGen/CGExpr.cpp | |
| parent | deb2002ceed01839ab9fb667d0dfc35688e04815 (diff) | |
| download | bcm5719-llvm-64cda8b5f3170ecc073d3ff2970e14c58234306c.tar.gz bcm5719-llvm-64cda8b5f3170ecc073d3ff2970e14c58234306c.zip | |
objective-C++ IRGen: property reference as an
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.
llvm-svn: 106247
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index aab54099fde..8655a66bd95 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1818,10 +1818,18 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { cast<CXXRecordDecl>(DerivedClassTy->getDecl()); LValue LV = EmitLValue(E->getSubExpr()); + llvm::Value *This; + if (LV.isPropertyRef()) { + RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getSubExpr()->getType()); + assert (!RV.isScalar() && "EmitCastLValue"); + This = RV.getAggregateAddr(); + } + else + This = LV.getAddress(); // Perform the derived-to-base conversion llvm::Value *Base = - GetAddressOfBaseClass(LV.getAddress(), DerivedClassDecl, + GetAddressOfBaseClass(This, DerivedClassDecl, E->getBasePath(), /*NullCheckValue=*/false); return LValue::MakeAddr(Base, MakeQualifiers(E->getType())); |

