[PATCH] D138028: [clangd] Fix action `RemoveUsingNamespace` for inline namespace
Tom Praschan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 15 11:09:32 PST 2022
tom-anders added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp:212
// Produce replacements to add the qualifiers.
std::string Qualifier = printUsingNamespaceName(Ctx, *TargetDirective) + "::";
for (auto Loc : IdentsToQualify) {
----------------
v1nh1shungry wrote:
> We can replace `printUsingNamespaceName` with `printNamespaceScope` here so that we can get `a::foobar()` in the test.
>
> However, it can sometimes cause redundancy such as in the 10th test.
>
> And I don't know whether it is worth it. WDYT?
Just making sure I understood this correctly:
If you replace `printUsingNamespaceName` with `printNamespaceScope`, then...
- ...in the test you added it would result in `a::foobar()` instead of `a::b::foobar()` (which is better)
- ... but in this test (which is the 10th test if I counted correctly):
```
namespace a::b { struct Foo {}; }
using namespace a;
using namespace a::[[b]];
using namespace b;
int main() { Foo F;}
```
what would be the result..? would you get `a::Foo` instead of `a::b::Foo`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138028/new/
https://reviews.llvm.org/D138028
More information about the cfe-commits
mailing list