usaxena95 marked 3 inline comments as done.
usaxena95 added inline comments.


================
Comment at: 
clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp:179
+
+  if (ContainingNS) {
+    for (auto ReDeclNS : ContainingNS->redecls())
----------------
ilya-biryukov wrote:
> Could you explain why don't we always just run across the whole TU?
> What disadvantages would that have?
Working with a using decl inside the `ContainingNS` is quite similar to our 
initial version with GlobalNS. 
For example we take advantage of that to replace the whole qualifier with just 
TargetNS. We use the fact that since `using namespace TargetNS;` was valid 
inside `ContainingNS` then qualifying the reference with just `TargetNS` would 
also be valid inside `ContainingNS`.

When we are outside `ContainingNS`,  we would have to fully qualify the ref to 
be 100% correct. To reduce the qualification we might have to figure out which 
is enclosing NS for the reference.

```
namespace aa {
namespace bb { 
struct map {}; 
}
using namespace b^b;
}
int main() { 
 aa::map m1;  // We do not qualify this currently.
}
```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69162/new/

https://reviews.llvm.org/D69162



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to