diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2007-12-29 05:02:41 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2007-12-29 05:02:41 +0000 |
commit | 22c940ee588a420cd2e6c8f68be2ac3cc80061ff (patch) | |
tree | 2fcf5d7177cc2b4b46279f26d5d96210f3738aee /CodeGen/CGExpr.cpp | |
parent | d3ba3f44ad3fc79f31ebbbe15a7a7f4a34226254 (diff) |
Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExpr.cpp')
-rw-r--r-- | CodeGen/CGExpr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp index 4cb897fe5d..84879bb28e 100644 --- a/CodeGen/CGExpr.cpp +++ b/CodeGen/CGExpr.cpp @@ -87,6 +87,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { return LValue::MakeAddr(llvm::UndefValue::get(Ty)); } + case Expr::CallExprClass: return EmitCallExprLValue(cast<CallExpr>(E)); case Expr::DeclRefExprClass: return EmitDeclRefLValue(cast<DeclRefExpr>(E)); case Expr::ParenExprClass:return EmitLValue(cast<ParenExpr>(E)->getSubExpr()); case Expr::PreDefinedExprClass: @@ -455,6 +456,12 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) { return EmitCallExpr(Callee, E); } +LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) { + // Can only get l-value for call expression returning aggregate type + RValue RV = EmitCallExpr(E); + return LValue::MakeAddr(RV.getAggregateAddr()); +} + RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, const CallExpr *E) { // The callee type will always be a pointer to function type, get the function // type. |