llvm-project/clang-tools-extra/change-namespace
Eric Liu ff51f011d1 [change-namespace] handle constructor initializer: Derived : Base::Base() {} and added conflict detections
Summary:
namespace nx { namespace ny { class Base { public: Base(i) {}} } }
namespace na {
namespace nb {
class X : public nx::ny {
public:
  X() : Base::Base(1) {}
};
}
}

When changing from na::nb to x::y, "Base::Base" will be changed to "nx::ny::Base" and
 "Base::" in "Base::Base" will be replaced with "nx::ny::Base" too, which causes
conflict. This conflict should've been detected when adding replacements but was hidden by `addOrMergeReplacement`. We now also detect conflict when adding replacements where conflict must not happen.

The namespace lookup is tricky here, we simply replace "Base::Base()" with "nx::ny::Base()" as a workaround, which compiles but not perfect.

Reviewers: hokein

Subscribers: bkramer, cfe-commits

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

llvm-svn: 287118
2016-11-16 16:54:53 +00:00
..
tool Print stack trace for clang-change-namespace tool. 2016-10-13 18:56:14 +00:00
CMakeLists.txt
ChangeNamespace.cpp [change-namespace] handle constructor initializer: Derived : Base::Base() {} and added conflict detections 2016-11-16 16:54:53 +00:00
ChangeNamespace.h [change-namespace] handle constructor initializer: Derived : Base::Base() {} and added conflict detections 2016-11-16 16:54:53 +00:00