[PATCH] D33532: [coroutines] Fix fallthrough diagnostics for coroutines

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 18:43:46 PDT 2017


EricWF added inline comments.


================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:378
     const Stmt *S = CS.getStmt();
-    if ((isa<ReturnStmt>(S) && !IsCoroutine) || isa<CoreturnStmt>(S)) {
+    if (isa<ReturnStmt>(S) || isa<CoreturnStmt>(S)) {
       HasLiveReturn = true;
----------------
GorNishanov wrote:
> Is this check no longer needed because of the changes to AnalysisDeclContext.cpp?
> 
> At some point it was needed because we were emitting "return gro" to produce the immediate return value from the coroutine, but, we wanted to flag the case when the user forgot to add "co_return"
I couldn't exactly figure out why this was no longer needed, but it appears we don't traverse those implicitly created return statements.

I made sure to test this particular part of the change to ensure it didn't regress behavior. If you look at the changes for `coreturn.cpp` you should see that case exercised.


https://reviews.llvm.org/D33532





More information about the cfe-commits mailing list