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
Differential D69022
[coroutines] Remove assert on CoroutineParameterMoves in Sema::buildCoroutineParameterMoves junparser on Oct 16 2019, 12:55 AM. Authored by
Details 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
Diff Detail
Event TimelineComment Actions Despite generally knowing about coroutines and generally knowing about Clang, I actually don't know the Clang coroutine code and can't review this properly. Comment Actions Sorry for the slow response here, @junparser! The test case you came up with here is great! I can see the issue is that ScopeInfo->CoroutineParameterMoves are built up when Clang parses the first co_await a, but are not cleared when lookupPromiseType results in an error. As a result, when Clang hits the second co_await a, it's in a state that the current code didn't anticipate. Your test case does a great job demonstrating this. Your fix for the problem also looks good to me! My only suggestion is to make the test case just a little clearer, as I'll explain... (Also, in the future could you please upload your patches with full context? You can read https://llvm.org/docs/Phabricator.html for more details. I think the section explaining the web interface might be relevant to you, where it suggests git show HEAD -U999999 > mypatch.patch. The reason I ask is because on Phabricator I can see what lines you're proposing should be added, but not the surrounding source lines, which made this more difficult to review.)
|