diff options
author | Haojian Wu <hokein@google.com> | 2016-10-07 08:29:20 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2016-10-07 08:29:20 +0000 |
commit | 096a55ac53488fc438ee77880f8b8ab5bbcad106 (patch) | |
tree | 005e46b7adecdbcb726f3ff107ead35cec855d25 /clang-tools-extra/test/clang-move | |
parent | 558ec101193fc9069922ad47fbdca9efcb9eb7e4 (diff) |
[clang-move] Support moving multiple classes in one run.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25309
Diffstat (limited to 'clang-tools-extra/test/clang-move')
5 files changed, 122 insertions, 2 deletions
diff --git a/clang-tools-extra/test/clang-move/Inputs/database_template.json b/clang-tools-extra/test/clang-move/Inputs/database_template.json index 2dc567ba2b0..daff4e54b2e 100644 --- a/clang-tools-extra/test/clang-move/Inputs/database_template.json +++ b/clang-tools-extra/test/clang-move/Inputs/database_template.json @@ -3,5 +3,10 @@ "directory": "$test_dir/build", "command": "clang++ -o test.o $test_dir/test.cpp", "file": "$test_dir/test.cpp" +}, +{ + "directory": "$test_dir/build", + "command": "clang++ -o test.o $test_dir/multiple_class_test.cpp", + "file": "$test_dir/multiple_class_test.cpp" } ] diff --git a/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.cpp b/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.cpp new file mode 100644 index 00000000000..302475baf0f --- /dev/null +++ b/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.cpp @@ -0,0 +1,27 @@ +#include "multiple_class_test.h" + +namespace a { +int Move1::f() { + return 0; +} +} // namespace a + +namespace b { +int Move2::f() { + return 0; +} +} // namespace b + +namespace c { +int Move3::f() { + return 0; +} + +int Move4::f() { + return 0; +} + +int NoMove::f() { + return 0; +} +} // namespace c diff --git a/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.h b/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.h new file mode 100644 index 00000000000..cedb8d58b0c --- /dev/null +++ b/clang-tools-extra/test/clang-move/Inputs/multiple_class_test.h @@ -0,0 +1,30 @@ +namespace a { +class Move1 { +public: + int f(); +}; +} // namespace a + +namespace b { +class Move2 { +public: + int f(); +}; +} // namespace b + +namespace c { +class Move3 { +public: + int f(); +}; + +class Move4 { +public: + int f(); +}; + +class NoMove { +public: + int f(); +}; +} // namespace c diff --git a/clang-tools-extra/test/clang-move/move-class.cpp b/clang-tools-extra/test/clang-move/move-class.cpp index 0c23608a9e9..af49cf5e1e5 100644 --- a/clang-tools-extra/test/clang-move/move-class.cpp +++ b/clang-tools-extra/test/clang-move/move-class.cpp @@ -3,7 +3,7 @@ // RUN: cp %S/Inputs/test* %T/clang-move/ // RUN: touch %T/clang-move/test2.h // RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp +// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s @@ -11,7 +11,7 @@ // // RUN: cp %S/Inputs/test* %T/clang-move/ // RUN: cd %T/clang-move -// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp +// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s diff --git a/clang-tools-extra/test/clang-move/move-multiple-classes.cpp b/clang-tools-extra/test/clang-move/move-multiple-classes.cpp new file mode 100644 index 00000000000..0633099789e --- /dev/null +++ b/clang-tools-extra/test/clang-move/move-multiple-classes.cpp @@ -0,0 +1,58 @@ +// RUN: mkdir -p %T/clang-move/build +// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json +// RUN: cp %S/Inputs/multiple_class_test* %T/clang-move/ +// RUN: cd %T/clang-move +// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp +// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s +// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s +// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s +// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s +// +// CHECK-OLD-TEST-H: namespace c { +// CHECK-OLD-TEST-H: class NoMove { +// CHECK-OLD-TEST-H: public: +// CHECK-OLD-TEST-H: int f(); +// CHECK-OLD-TEST-H: }; +// CHECK-OLD-TEST-H: } // namespace c + +// CHECK-OLD-TEST-CPP: #include "{{.*}}multiple_class_test.h" +// CHECK-OLD-TEST-CPP: namespace c { +// CHECK-OLD-TEST-CPP: int NoMove::f() { +// CHECK-OLD-TEST-CPP: return 0; +// CHECK-OLD-TEST-CPP: } +// CHECK-OLD-TEST-CPP: } // namespace c + +// CHECK-NEW-TEST-H: namespace a { +// CHECK-NEW-TEST-H: class Move1 { +// CHECK-NEW-TEST-H: public: +// CHECK-NEW-TEST-H: int f(); +// CHECK-NEW-TEST-H: }; +// CHECK-NEW-TEST-H: } // namespace a +// CHECK-NEW-TEST-H: namespace b { +// CHECK-NEW-TEST-H: class Move2 { +// CHECK-NEW-TEST-H: public: +// CHECK-NEW-TEST-H: int f(); +// CHECK-NEW-TEST-H: }; +// CHECK-NEW-TEST-H: } // namespace b +// CHECK-NEW-TEST-H: namespace c { +// CHECK-NEW-TEST-H: class Move3 { +// CHECK-NEW-TEST-H: public: +// CHECK-NEW-TEST-H: int f(); +// CHECK-NEW-TEST-H: }; +// CHECK-NEW-TEST-H: class Move4 { +// CHECK-NEW-TEST-H: public: +// CHECK-NEW-TEST-H: int f(); +// CHECK-NEW-TEST-H: }; +// CHECK-NEW-TEST-H: } // namespace c + +// CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h" +// CHECK-NEW-TEST-CPP: namespace a { +// CHECK-NEW-TEST-CPP: int Move1::f() { return 0; } +// CHECK-NEW-TEST-CPP: } // namespace a +// CHECK-NEW-TEST-CPP: namespace b { +// CHECK-NEW-TEST-CPP: int Move2::f() { return 0; } +// CHECK-NEW-TEST-CPP: } // namespace b +// CHECK-NEW-TEST-CPP: namespace c { +// CHECK-NEW-TEST-CPP: int Move3::f() { return 0; } +// CHECK-NEW-TEST-CPP: int Move4::f() { return 0; } +// CHECK-NEW-TEST-CPP: } // namespace c |