llvm-project/clang-tools-extra/change-namespace
Eric Liu 9a54397f81 [change-namespace] Don't match a function call/ref multiple times.
Summary:
Previously, the matcher matches a function call/ref multiple times, one
for each decl ancestor. This might cause problems. For example, in the following
case, `func()` would be matched once (with namespace context) before using decl is
seen and once after using decl is seeing, which would result in different conflicting
replacements as the first match would replace `func` with "ns::func" as it doesn't
know about the using decl.

```
namespace x {
namespace {
using ::ns::func;
void f() { func(); }
}
}
```

Switching from `hasDescendant` matching to `hasAncestor` matching solves the
problem.

Reviewers: hokein

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D44517

llvm-svn: 327629
2018-03-15 14:45:02 +00:00
..
tool [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
CMakeLists.txt
ChangeNamespace.cpp [change-namespace] Don't match a function call/ref multiple times. 2018-03-15 14:45:02 +00:00
ChangeNamespace.h [change-namepsace] make it possible to whitelist symbols so they don't get updated. 2017-02-24 11:54:45 +00:00