diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-01-27 23:22:05 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-01-27 23:22:05 +0000 |
| commit | 21d3fca917ec5b9dce432b802bc113bd7e50d2be (patch) | |
| tree | 0d8ca5fc68b56f905b8418feb0286dec4e2edb84 /clang/lib | |
| parent | e4de27900921801cfbddeb02b725740fe2c0c5cc (diff) | |
| download | bcm5719-llvm-21d3fca917ec5b9dce432b802bc113bd7e50d2be.tar.gz bcm5719-llvm-21d3fca917ec5b9dce432b802bc113bd7e50d2be.zip | |
When producing IR for a lvalue-to-rvalue cast *as an lvalue*, only
non-class prvalues actually require the realization of a
temporary. For everything else, we already have an lvalue (or class
prvalue) in the subexpression.
Note: we're missing some move elision in this case. I'll tackle that next.
llvm-svn: 124453
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index ca80d3dd38e..8bac4c0b02b 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1772,11 +1772,12 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { } case CK_NoOp: - if (!E->getSubExpr()->isRValue() || E->getType()->isRecordType()) + case CK_LValueToRValue: + if (!E->getSubExpr()->Classify(getContext()).isPRValue() + || E->getType()->isRecordType()) return EmitLValue(E->getSubExpr()); // Fall through to synthesize a temporary. - case CK_LValueToRValue: case CK_BitCast: case CK_ArrayToPointerDecay: case CK_FunctionToPointerDecay: |

