[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
Sat Jul 20 08:58:40 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:
Checkout https://godbolt.org/z/xncofxfdd (and maybe add the examples as test cases)
It's possible to match the type of the function parameter to that of the cast if it is written, however, not an instantiation dependent type like when using type-traits to add the reference.
I think this shortcoming is worth it if we can ensure that the `static_cast` is only about being explicit.
https://github.com/llvm/llvm-project/pull/99477
More information about the cfe-commits
mailing list