[clang-tools-extra] [clang-tidy][performance-unnecessary-value-param] Avoid in coroutines (PR #140912)
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 02:41:04 PDT 2025
================
@@ -63,7 +65,11 @@ void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
TK_AsIs,
- functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
+ functionDecl(hasBody(IsAllowedInCoroutines
+ ? stmt()
+ : static_cast<StmtMatcher>(
+ unless(coroutineBodyStmt()))),
----------------
dmpolukhin wrote:
Unfortunately this static_cast cannot be avoided because the second and third arguments of the ternary operator have different types so it gives compiler error and I was not able to find the way to avoid it without ugly conversion (it can be C-style but I don't think it will make the code more readable). It was the reason why I used check inside matcher callback in the previous version.
https://github.com/llvm/llvm-project/pull/140912
More information about the cfe-commits
mailing list