[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 10:01:22 PDT 2024
================
@@ -129,15 +129,19 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) {
unless(anyOf(hasAncestor(typeLoc()),
hasAncestor(expr(hasUnevaluatedContext())))));
+ auto StaticCast = cxxStaticCastExpr(
+ hasSourceExpression(declRefExpr(to(equalsBoundNode("param")))));
----------------
5chmidti wrote:
You should constrain the target type to be the same as `param` (minus cvref), to ensure this is actually about being explicit in how the parameter is used, and not a cast to a different type (e.g., `T&&` -> `float`).
https://github.com/llvm/llvm-project/pull/99477
More information about the cfe-commits
mailing list