[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 07:45:25 PDT 2023


================
@@ -0,0 +1,48 @@
+.. title:: clang-tidy - misc-coroutine-hostile-raii
+
+misc-coroutine-hostile-raii
+====================
+
+This check detects hostile-RAII objects which should not persist across a 
+suspension point in a coroutine.
+
+Some objects require that they be destroyed on the same thread that created them. 
+Traditionally this requirement was often phrased as "must be a local variable",
+under the assumption that local variables always work this way. However this is
+incorrect with C++20 coroutines, since an intervening `co_await` may cause the
----------------
EugeneZelenko wrote:

Please use double back-ticks for language constructs. Same in other places.

https://github.com/llvm/llvm-project/pull/68738


More information about the cfe-commits mailing list