[clang] [clang-tools-extra] [clang-tidy] Add support for use-after-suspend to bugprone-use-after-move (PR #172566)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 22:10:48 PST 2026


================
@@ -81,8 +81,30 @@ class UseAfterMoveFinder {
   llvm::SmallPtrSet<const CFGBlock *, 8> Visited;
 };
 
+// Matches the expression awaited by the `co_await`.
+// TODO: Merge with the `awaitable` matcher in CoroutineHostileRAIICheck.
+AST_MATCHER_P(CoroutineSuspendExpr, suspendExpr,
+              ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
+  if (const Expr *E = Node.getOperand())
+    return InnerMatcher.matches(*E, Finder, Builder);
+  return false;
+}
+
 } // namespace
 
+// TODO: Merge with the corresponding function in CoroutineHostileRAIICheck.
+static auto typeWithNameIn(const std::vector<StringRef> &Names) {
----------------
zeyi2 wrote:

I think `llvm::ArrayRef<StringRef>` would be better here :)

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


More information about the cfe-commits mailing list