summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-01-11 01:24:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-01-11 01:24:05 +0000
commit454b4af0b0bb4234c0c2f56b935323c17043c447 (patch)
tree5b2d447128f2ae9d4e004684fa1495413f2f62a1 /clang/lib/CodeGen/CGStmt.cpp
parent55d3a0c3d4777d8bbb5c5ddc735d5d61b328a2b2 (diff)
downloadbcm5719-llvm-454b4af0b0bb4234c0c2f56b935323c17043c447.tar.gz
bcm5719-llvm-454b4af0b0bb4234c0c2f56b935323c17043c447.zip
PR12208: Under -fno-elide-constructors, don't forget to actually copy an NRVO
variable to the return slot. Patch by David Wiberg, with test case alterations by me. llvm-svn: 198991
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index b18ff09015a..83b5fa9228a 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -871,7 +871,8 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
// FIXME: Clean this up by using an LValue for ReturnTemp,
// EmitStoreThroughLValue, and EmitAnyExpr.
- if (S.getNRVOCandidate() && S.getNRVOCandidate()->isNRVOVariable()) {
+ if (getLangOpts().ElideConstructors &&
+ S.getNRVOCandidate() && S.getNRVOCandidate()->isNRVOVariable()) {
// Apply the named return value optimization for this return statement,
// which means doing nothing: the appropriate result has already been
// constructed into the NRVO variable.
OpenPOWER on IntegriCloud