summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-01 19:36:41 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-01 19:36:41 +0000
commit61a312413c82aa23ef63467cde87f6de1ce8724f (patch)
tree92cb2ca63a66e4d46b7b6b7d9919b2bfb0b8dac2 /clang/lib/CodeGen
parentdf6b67bf852b6e2a12eb6f0963e85cc96c596fcf (diff)
downloadbcm5719-llvm-61a312413c82aa23ef63467cde87f6de1ce8724f.tar.gz
bcm5719-llvm-61a312413c82aa23ef63467cde87f6de1ce8724f.zip
Fix IRGen when property-dot syntax used to access
a c++ class object 'ivar'. Fixes radar 8366604. llvm-svn: 112729
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp13
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp19
2 files changed, 23 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 1af0d56b448..06c657fa926 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1753,9 +1753,11 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
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 CodeGenFunction::EmitCastLValue(const CastExpr *E) {
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();
}
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 34d7a764b23..1a95d4bb095 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -203,11 +203,17 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
"EmitCXXOperatorMemberCallExpr - user declared copy assignment");
LValue LV = EmitLValue(E->getArg(0));
llvm::Value *This;
- if (LV.isPropertyRef()) {
+ if (LV.isPropertyRef() || LV.isKVCRef()) {
llvm::Value *AggLoc = CreateMemTemp(E->getArg(1)->getType());
EmitAggExpr(E->getArg(1), AggLoc, false /*VolatileDest*/);
- EmitObjCPropertySet(LV.getPropertyRefExpr(),
- RValue::getAggregate(AggLoc, false /*VolatileDest*/));
+ if (LV.isPropertyRef())
+ EmitObjCPropertySet(LV.getPropertyRefExpr(),
+ RValue::getAggregate(AggLoc,
+ false /*VolatileDest*/));
+ else
+ EmitObjCPropertySet(LV.getKVCRefExpr(),
+ RValue::getAggregate(AggLoc,
+ false /*VolatileDest*/));
return RValue::getAggregate(0, false);
}
else
@@ -226,8 +232,11 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
FPT->isVariadic());
LValue LV = EmitLValue(E->getArg(0));
llvm::Value *This;
- if (LV.isPropertyRef()) {
- RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getArg(0)->getType());
+ if (LV.isPropertyRef() || LV.isKVCRef()) {
+ QualType QT = E->getArg(0)->getType();
+ RValue RV =
+ LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT)
+ : EmitLoadOfKVCRefLValue(LV, QT);
assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr");
This = RV.getAggregateAddr();
}
OpenPOWER on IntegriCloud