Fix IRGen when property-dot syntax used to access
a c++ class object 'ivar'. Fixes radar 8366604.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112729 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 1af0d56..06c657f 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1753,9 +1753,11 @@
if (E->getSubExpr()->Classify(getContext()).getKind()
!= Expr::Classification::CL_PRValue) {
LValue LV = EmitLValue(E->getSubExpr());
- if (LV.isPropertyRef()) {
+ if (LV.isPropertyRef() || LV.isKVCRef()) {
QualType QT = E->getSubExpr()->getType();
- RValue RV = EmitLoadOfPropertyRefLValue(LV, QT);
+ RValue RV =
+ LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT)
+ : EmitLoadOfKVCRefLValue(LV, QT);
assert(!RV.isScalar() && "EmitCastLValue-scalar cast of property ref");
llvm::Value *V = RV.getAggregateAddr();
return MakeAddrLValue(V, QT);
@@ -1810,8 +1812,11 @@
LValue LV = EmitLValue(E->getSubExpr());
llvm::Value *This;
- if (LV.isPropertyRef()) {
- RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getSubExpr()->getType());
+ if (LV.isPropertyRef() || LV.isKVCRef()) {
+ QualType QT = E->getSubExpr()->getType();
+ RValue RV =
+ LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT)
+ : EmitLoadOfKVCRefLValue(LV, QT);
assert (!RV.isScalar() && "EmitCastLValue");
This = RV.getAggregateAddr();
}