This is an archive of the discontinued LLVM Phabricator instance.

Fully qualify the renamed symbol if the shortened name is ambiguous.
ClosedPublic

Authored by ioeric on Aug 2 2018, 8:06 AM.

Details

Summary

For example, when renaming a::b::x::foo to y::foo below, replacing
x::foo() with y::foo() can cause ambiguity. In such cases, we simply fully
qualify the name with leading ::.

namespace a {
namespace b {
namespace x { void foo() {} }
namespace y { void foo() {} }
}
}

namespace a {
namespace b {
void f() { x::foo(); }
}
}

Diff Detail

Event Timeline

ioeric created this revision.Aug 2 2018, 8:06 AM
ioeric updated this revision to Diff 158761.Aug 2 2018, 8:07 AM
  • minor update to comment.
ioeric edited the summary of this revision. (Show Details)Aug 2 2018, 8:08 AM
ilya-biryukov added inline comments.Aug 2 2018, 9:06 AM
lib/Tooling/Core/Lookup.cpp
137

maybe use range-based-for here? I.e. for (const NamespaceDecl* NS : UseNamespaces) { ... }

139

This will not take using namespaces into account, right? Do we care about those or is this a known limitation of the tools?

ioeric updated this revision to Diff 158941.Aug 3 2018, 1:19 AM
ioeric marked 2 inline comments as done.
  • address review comments.
ioeric added inline comments.Aug 3 2018, 1:19 AM
lib/Tooling/Core/Lookup.cpp
139

Right, I think we don't handle using namespaces in this library due to limitation/importance etc. Added a FIXME.

This revision is now accepted and ready to land.Aug 3 2018, 1:38 AM
This revision was automatically updated to reflect the committed changes.