hanchenye-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
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