[PATCH] D89332: [clang-tidy] performance-unnecessary-copy-initialization: Always allow std::function to be copied.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 23:59:22 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp:409
+
+namespace std {
+
----------------
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.


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