[PATCH] D89332: [clang-tidy] performance-unnecessary-copy-initialization: Always allow std::function to be copied.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 17 00:11:55 PDT 2020
njames93 added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp:409
+
+namespace std {
+
----------------
gribozavr2 wrote:
> flx wrote:
> > gribozavr2 wrote:
> > > Could you add a nested inline namespace to better imitate what declarations look like in libc++?
> > I'm not sure I follow. I looked through the other tests that declare a std function and copied the declaration from modernize-avoid-bind.cpp.
> libc++ declarations look like this:
>
> ```
> namespace std {
> inline namespace __1 {
> template<...> struct function...
> } // __1
> } // std
> ```
>
> The inline namespace in the middle often trips up declaration matching in checkers. And yes, many other tests don't imitate this pattern, and are often broken with libc++. Those tests should be improved.
@flx Thats the reason why its advisable to use `Decl::isInStdNamespace` as it will handle inline namespaces.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89332/new/
https://reviews.llvm.org/D89332
More information about the cfe-commits
mailing list