[PATCH] D147417: [clang-tidy] Do not emit bugprone-exception-escape warnings from coroutines

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 3 08:23:15 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp:91
+const auto d_ShouldNotDiag = [](const int a, const int b) -> task<int> {
+  // CHECK-MESSAGES-NOT: :[[@LINE-1]]:30: warning: an exception may be thrown in function 'operator()' which should not throw exceptions
+  if (b == 0)
----------------
And based on ChuanqiXu comment, same here.

"All exceptions thrown in coroutine bodies are caught and
unhandled_exception member of the coroutine promise type is called."
This isn't expected behaviour, as it may hide exception.
Based on that we should assume, if there is noexcept, then it should not throw, and if its no noexcept, then it could throw. No point to change default behaviour then. 

Other option is to add check option to handle this.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147417/new/

https://reviews.llvm.org/D147417



More information about the cfe-commits mailing list