diff options
author | Taiju Tsuiki <tzik@google.com> | 2018-06-19 05:35:30 +0000 |
---|---|---|
committer | Taiju Tsuiki <tzik@google.com> | 2018-06-19 05:35:30 +0000 |
commit | 3be68e162ffbf992c2efbc70983d27c05739a8b0 (patch) | |
tree | ce47a7000d746109fb539ef4741b57eea3295118 /clang/lib/Sema/SemaExpr.cpp | |
parent | ea798aa7f596060d4be4e3c6bcadcda77a63829e (diff) | |
download | bcm5719-llvm-3be68e162ffbf992c2efbc70983d27c05739a8b0.tar.gz bcm5719-llvm-3be68e162ffbf992c2efbc70983d27c05739a8b0.zip |
Revert r335019 "Update NRVO logic to support early return (Attempt 2)"
llvm-svn: 335022
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 220d6906954..aeedd6b1691 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13385,9 +13385,13 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, if (Body && getCurFunction()->HasPotentialAvailabilityViolations) DiagnoseUnguardedAvailabilityViolations(BSI->TheDecl); - // Try to apply the named return value optimization. - computeNRVO(Body, BSI); - + // Try to apply the named return value optimization. We have to check again + // if we can do this, though, because blocks keep return statements around + // to deduce an implicit return type. + if (getLangOpts().CPlusPlus && RetTy->isRecordType() && + !BSI->TheDecl->isDependentContext()) + computeNRVO(Body, BSI); + BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy); AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy(); PopFunctionScopeInfo(&WP, Result->getBlockDecl(), Result); |