hokein added inline comments.

================
Comment at: change-namespace/ChangeNamespace.cpp:566
+      break;
+    if (isDeclVisibleAtLocation(*Result.SourceManager, Using, DeclCtx, Start)) 
{
+      for (const auto *UsingShadow : Using->shadows()) {
----------------
Yeah, it works for most cases, but it can not guarantee that they are still in 
the same DeclContext after changing to new namespace.

For example, the following case where an using-decl is used in the namespace 
being renamed, we change `b::c` to `d::e`, although DeclContext `d` of callexpr 
`f()` is a nested DeclContext of `b` (also DeclContext of `using a::f`), but 
this assumption is wrong after changing namespace because we keep `using a::f` 
in its original namespace.

```
namespace a { void f(); }

namespace b {
using a::f;
namespace c {
void d() { f(); }
}  // c
} // b
```

Not sure whether we should do this in our tool. I suspect there might be a lot 
of corner cases.



https://reviews.llvm.org/D25771



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

Reply via email to