Commit Graph

4 Commits

Author SHA1 Message Date
Eric Liu b9bf1b5b85 [change-namespace] shorten namespace qualifier based on UsingDecl and UsingDirectiveDecl.
Summary:
when replacing symbol references in moved namespaces, trying to make the replace
name as short as possible by considering UsingDecl (i.e. UsingShadow) and
UsingDirectiveDecl (i.e. using namespace decl).

Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25771

llvm-svn: 286307
2016-11-08 22:44:17 +00:00
Eric Liu 68765a848b [change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24784

llvm-svn: 282073
2016-09-21 15:06:12 +00:00
Eric Liu cc83c66ee9 Trying to fix name conflict in change-namespace tool.
llvm-svn: 281920
2016-09-19 17:58:59 +00:00
Eric Liu 495b211a6c A clang tool for changing surrouding namespaces of class/function definitions.
Summary:
A tool for changing surrouding namespaces of class/function definitions while keeping
references to types in the changed namespace correctly qualified by prepending
namespace specifiers before them.

Example: test.cc
   namespace na {
   class X {};
   namespace nb {
   class Y { X x; };
   } // namespace nb
   } // namespace na

To move the definition of class Y from namespace "na::nb" to "x::y", run:
   clang-change-namespace --old_namespace "na::nb" \
     --new_namespace "x::y" --file_pattern "test.cc" test.cc --

Output:
   namespace na {
   class X {};
   } // namespace na
   namespace x {
   namespace y {
   class Y { na::X x; };
   } // namespace y
   } // namespace x

Reviewers: alexfh, omtcyfz, hokein

Subscribers: mgorny, klimek, djasper, beanz, alexshap, Eugene.Zelenko, cfe-commits

Differential Revision: https://reviews.llvm.org/D24183

llvm-svn: 281918
2016-09-19 17:40:32 +00:00