aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp
diff options
context:
space:
mode:
authorUtkarsh Saxena <usx@google.com>2024-01-23 23:07:00 +0100
committerGitHub <noreply@github.com>2024-01-23 23:07:00 +0100
commit729657d6e15d0455557f35485deb87313ccdde10 (patch)
treee27262d2925897d28d27f92469947380ae891658 /clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp
parent9d476e1e1a18af390e3455a6622ee67a69c64103 (diff)
downloadllvm-729657d6e15d0455557f35485deb87313ccdde10.zip
llvm-729657d6e15d0455557f35485deb87313ccdde10.tar.gz
llvm-729657d6e15d0455557f35485deb87313ccdde10.tar.bz2
[misc-coroutine-hostile-raii] Use getOperand instead of getCommonExpr. (#79206)
We were previously allowlisting awaitable types returned by `await_transform` instead of the type of the operand of the `co_await` expression. This previously used to give false positives and not respect the `AllowedAwaitablesList` flag when `await_transform` is used. See added test cases for such examples.
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp b/clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp
index a0e8700..360335b 100644
--- a/clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp
@@ -56,7 +56,7 @@ AST_MATCHER_P(Stmt, forEachPrevStmt, ast_matchers::internal::Matcher<Stmt>,
// Matches the expression awaited by the `co_await`.
AST_MATCHER_P(CoawaitExpr, awaitable, ast_matchers::internal::Matcher<Expr>,
InnerMatcher) {
- if (Expr *E = Node.getCommonExpr())
+ if (Expr *E = Node.getOperand())
return InnerMatcher.matches(*E, Finder, Builder);
return false;
}