njames93 added a comment.
How does this type alias and typedef, In theory that should also be handled.
using Functor = std::function<...>;
Functor Copy = Orig; // No warning.
================
Comment at:
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp:39-44
+AST_MATCHER(NamedDecl, isStdFunction) {
+ // First use the fast getName() method to avoid unnecessary calls to the
+ // slow getQualifiedNameAsString().
+ return Node.getName() == "function" &&
+ Node.getQualifiedNameAsString() == "std::function";
+}
----------------
It's better to use `node.isInStdNamespace()` instead of checking the qualified
name as its designed for that very purpose. Is should probably take a
`CXXRecordDecl` instead of a `NamedDecl` aswell.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89332/new/
https://reviews.llvm.org/D89332
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits