diff options
author | Eric Liu <ioeric@google.com> | 2018-03-15 14:45:02 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-03-15 14:45:02 +0000 |
commit | 414ad1ebb317a66111ef521aadbfe97f6c1faf3b (patch) | |
tree | 0b7a04200c0a5cc045e6328d634b6abf8b7af6e3 /clangd/CodeComplete.cpp | |
parent | 32a44d6e3a088d33b2e7a93d7cfc428ec946ae4c (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@327629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clangd/CodeComplete.cpp')
0 files changed, 0 insertions, 0 deletions