diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-30 05:35:15 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-30 05:35:15 +0000 |
commit | 7f8ea5c5b3a6a4332a841eefdd86b0726722ea7b (patch) | |
tree | 48b6d4e8853ec43fafe2c9cf048f42e07d9a1e03 /lib/CodeGen/CGExprAgg.cpp | |
parent | 19cd87eb5fb3c197e631ce08fd52c446c4d4e8f1 (diff) |
Add Objective-C property setter support.
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
favor of just result type and selector. Necessary so it can be
reused in situations where we don't want to cons up an
ObjCMessageExpr.
- Update aggregate binary assignment to know about special property
ref lvalues.
- Add CodeGenFunction::EmitCallArg overload which takes an already
emitted rvalue.
Add CodeGenFunction::StoreComplexIntoAddr.
Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.
Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index d335ea9c3f..11eb9fc115 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -264,14 +264,26 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { && "Invalid assignment"); LValue LHS = CGF.EmitLValue(E->getLHS()); - // Codegen the RHS so that it stores directly into the LHS. - CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), false /*FIXME: VOLATILE LHS*/); - - if (DestPtr == 0) - return; - - // If the result of the assignment is used, copy the RHS there also. - EmitAggregateCopy(DestPtr, LHS.getAddress(), E->getType()); + // We have to special case property setters, otherwise we must have + // a simple lvalue (no aggregates inside vectors, bitfields). + if (LHS.isPropertyRef()) { + // FIXME: Volatility? + llvm::Value *AggLoc = DestPtr; + if (!AggLoc) + AggLoc = CGF.CreateTempAlloca(CGF.ConvertType(E->getRHS()->getType())); + CGF.EmitAggExpr(E->getRHS(), AggLoc, false); + CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), + RValue::getAggregate(AggLoc)); + } else { + // Codegen the RHS so that it stores directly into the LHS. + CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), false /*FIXME: VOLATILE LHS*/); + + if (DestPtr == 0) + return; + + // If the result of the assignment is used, copy the RHS there also. + EmitAggregateCopy(DestPtr, LHS.getAddress(), E->getType()); + } } void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) { |