[PATCH] D25771: [change-namespace] shorten namespace qualifier based on UsingDecl and UsingDirectiveDecl.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 16:15:39 PST 2016
ioeric added inline comments.
================
Comment at: change-namespace/ChangeNamespace.cpp:277
+ auto IsVisibleInOldNs =
+ anyOf(IsInMovedNs, unless(hasAncestor(namespaceDecl(hasName(Prefix)))));
+ // Match using declarations.
----------------
hokein wrote:
> Ignoring using-decls in `Prefix` namespace-decl doesn't work perfectly. The same example:
>
> ```
> namespace a { void f(); }
>
> namespace b {
> using a::f;
> namespace c {
> void d() { f(); }
> }
> }
> ```
>
> When changing `b::c` to `b::e`, the `using a::f;` will be excluded by this filter. As a result, `a::` will be added to `f()`.
Nice catch! Fixed and explained in the new code.
https://reviews.llvm.org/D25771
More information about the cfe-commits
mailing list