forked from OSchip/llvm-project
Handle function calls that return aggregate expressions.
llvm-svn: 43581
This commit is contained in:
parent
d822d68b74
commit
0370eb2034
|
@ -67,7 +67,7 @@ public:
|
|||
// case Expr::UnaryOperatorClass:
|
||||
// case Expr::ImplicitCastExprClass:
|
||||
// case Expr::CastExprClass:
|
||||
// case Expr::CallExprClass:
|
||||
void VisitCallExpr(const CallExpr *E);
|
||||
void VisitStmtExpr(const StmtExpr *E);
|
||||
void VisitBinaryOperator(const BinaryOperator *BO);
|
||||
void VisitBinAssign(const BinaryOperator *E);
|
||||
|
@ -132,6 +132,19 @@ void AggExprEmitter::EmitAggLoadOfLValue(const Expr *E) {
|
|||
// Visitor Methods
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void AggExprEmitter::VisitCallExpr(const CallExpr *E)
|
||||
{
|
||||
RValue RV = CGF.EmitCallExpr(E);
|
||||
assert(RV.isAggregate() && "Return value must be aggregate value!");
|
||||
|
||||
// If the result is ignored, don't copy from the value.
|
||||
if (DestPtr == 0)
|
||||
// FIXME: If the source is volatile, we must read from it.
|
||||
return;
|
||||
|
||||
EmitAggregateCopy(DestPtr, RV.getAggregateAddr(), E->getType());
|
||||
}
|
||||
|
||||
void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
|
||||
CGF.EmitCompoundStmt(*E->getSubStmt(), true, DestPtr, VolatileDest);
|
||||
}
|
||||
|
|
|
@ -63,3 +63,17 @@ void f4() {
|
|||
void f5() {
|
||||
(f3())->d1 = 42;
|
||||
}
|
||||
|
||||
/* Function calls */
|
||||
typedef struct {
|
||||
int location;
|
||||
int length;
|
||||
} range;
|
||||
|
||||
extern range f6();
|
||||
void f7()
|
||||
{
|
||||
range r = f6();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue