[PATCH] D79496: [clangd] Fix AddUsing tweak for out-of-line functions.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 12:26:05 PDT 2020
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.
thanks.
================
Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:2673
+void foo::fun() {
+ one::two::f^f();
+})cpp",
----------------
IIUC, before this patch, the using was added inside the above namespace `foo`, the code was still valid after applying the tweak.
There is no enclosing namespace for `foo::fun()`, so we will insert the using at the first top-level decl. It seems that we will break the code if the `one::two::ff` decl is defined in the main file (not the `test.hpp`), e.g.
```
// using one::two::ff will be inserted here, which is not valid
namespace one {
namespace two {
void ff();
}
}
namespace foo { void fun(); }
void foo::fun() {...}
```
this case was working before the patch, and now is broken after this patch. It is not a common case, probably ok for now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79496/new/
https://reviews.llvm.org/D79496
More information about the cfe-commits
mailing list