[clang] [clang] Ignore inline namespace for `hasName` (PR #109147)

Alejandro Álvarez Ayllón via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 23:53:12 PDT 2024


alejandro-alvarez-sonarsource wrote:

> Also, it needs a release note I think for the matcher change.

Added.

> I have no problem with the code here, but don't know enough about ASTMatchers to be able to review this for 'well justified'. Do we have someone besides Aaron who does?

FWIW this is an assertion error we saw downstream on debug builds with a snippet like the following (reduced), when trying to find `std::move`.

```cpp
namespace std {

inline namespace __1 {
template <class T> T &&move(T &&t) noexcept;

} // namespace __1
} // namespace std

namespace WTF {
enum CheckMoveParameterTag {};
}

namespace std {
template <WTF::CheckMoveParameterTag, typename T>
inline constexpr T &&move(T &&value) {
  return move(value);
}
} // namespace std

template <typename T> void f1(T t) { std::move(t); }

template void f1<int>(int);
```

The original code comes from [WebKit](https://github.com/qtwebkit/qtwebkit/blob/a60f9b3b9fc5236496f278fdf9df4855f41aab0f/PerformanceTests/StitchMarker/wtf/StdLibExtras.h#L502)

https://github.com/llvm/llvm-project/pull/109147


More information about the cfe-commits mailing list