[coroutines] Fix fallthrough diagnostics for coroutines
Summary: This patch fixes a number of issues with the analysis warnings emitted when a coroutine may reach the end of the function w/o returning. * Fix bug where coroutines with `return_value` are incorrectly diagnosed as missing `co_return`'s. * Rework diagnostic message to no longer say "non-void coroutine", because that implies the coroutine doesn't have a void return type, which it might. In this case a non-void coroutine is one who's promise type does not contain `return_void()` As a side-effect of this patch, coroutine bodies that contain an invalid coroutine promise objects are marked as invalid. Reviewers: GorNishanov, rsmith, aaron.ballman, majnemer Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33532 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303831 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/DiagnosticSemaKinds.td 2 additions, 2 deletionsinclude/clang/Basic/DiagnosticSemaKinds.td
- include/clang/Sema/ScopeInfo.h 2 additions, 0 deletionsinclude/clang/Sema/ScopeInfo.h
- lib/Analysis/AnalysisDeclContext.cpp 2 additions, 0 deletionslib/Analysis/AnalysisDeclContext.cpp
- lib/Sema/AnalysisBasedWarnings.cpp 13 additions, 17 deletionslib/Sema/AnalysisBasedWarnings.cpp
- lib/Sema/SemaCoroutine.cpp 5 additions, 2 deletionslib/Sema/SemaCoroutine.cpp
- lib/Sema/SemaDecl.cpp 1 addition, 1 deletionlib/Sema/SemaDecl.cpp
- test/SemaCXX/coreturn.cpp 99 additions, 3 deletionstest/SemaCXX/coreturn.cpp
- test/SemaCXX/coroutines.cpp 11 additions, 0 deletionstest/SemaCXX/coroutines.cpp
Loading
Please register or sign in to comment