Revert "[coroutines] Fix application of NRVO to Coroutine "Gro" or return object."
This reverts commit r323712. It's causing some test failures on certain machines.
Not sure why, will investigate.
llvm-svn: 323717
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 67c8b9b..f05a94e 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1316,6 +1316,10 @@
if (Res.isInvalid())
return false;
+ if (GroType == FnRetType) {
+ GroDecl->setNRVOVariable(true);
+ }
+
S.AddInitializerToDecl(GroDecl, Res.get(),
/*DirectInit=*/false);
@@ -1339,8 +1343,6 @@
noteMemberDeclaredHere(S, ReturnValue, Fn);
return false;
}
- if (cast<clang::ReturnStmt>(ReturnStmt.get())->getNRVOCandidate() == GroDecl)
- GroDecl->setNRVOVariable(true);
this->ReturnStmt = ReturnStmt.get();
return true;