[coroutines] Remove assert on CoroutineParameterMoves in Sema::buildCoroutineParameterMoves
Summary:
The assertion of CoroutineParameterMoves happens when build coroutine function with arguments multiple time while fails to build promise type.
Fix: use return false instead.
Test Plan: check-clang
Reviewers: modocache, GorNishanov, rjmccall
Reviewed By: modocache
Subscribers: rjmccall, EricWF, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69022
Patch by junparser (JunMa)!
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 7c125e9..271c4a1 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1527,8 +1527,8 @@
auto *FD = cast<FunctionDecl>(CurContext);
auto *ScopeInfo = getCurFunction();
- assert(ScopeInfo->CoroutineParameterMoves.empty() &&
- "Should not build parameter moves twice");
+ if (!ScopeInfo->CoroutineParameterMoves.empty())
+ return false;
for (auto *PD : FD->parameters()) {
if (PD->getType()->isDependentType())