diff options
Diffstat (limited to 'clang-tools-extra/test')
33 files changed, 0 insertions, 556 deletions
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt index 3aedde585f3..16541f98470 100644 --- a/clang-tools-extra/test/CMakeLists.txt +++ b/clang-tools-extra/test/CMakeLists.txt @@ -44,7 +44,6 @@ set(CLANG_TOOLS_TEST_DEPS clang-include-fixer clang-move clang-query - clang-rename clang-reorder-fields clang-tidy find-all-symbols diff --git a/clang-tools-extra/test/clang-rename/ClassAsTemplateArgument.cpp b/clang-tools-extra/test/clang-rename/ClassAsTemplateArgument.cpp deleted file mode 100644 index 2e09a5b529e..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassAsTemplateArgument.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Foo /* Test 1 */ {}; // CHECK: class Bar /* Test 1 */ {}; - -template <typename T> -void func() {} - -template <typename T> -class Baz {}; - -int main() { - func<Foo>(); // CHECK: func<Bar>(); - Baz<Foo> /* Test 2 */ obj; // CHECK: Baz<Bar> /* Test 2 */ obj; - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=215 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/ClassFindByName.cpp b/clang-tools-extra/test/clang-rename/ClassFindByName.cpp deleted file mode 100644 index 4430891ec4b..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassFindByName.cpp +++ /dev/null @@ -1,10 +0,0 @@ -class Foo { // CHECK: class Bar { -}; - -int main() { - Foo *Pointer = 0; // CHECK: Bar *Pointer = 0; - return 0; -} - -// Test 1. -// RUN: clang-rename -qualified-name=Foo -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s diff --git a/clang-tools-extra/test/clang-rename/ClassReplacements.cpp b/clang-tools-extra/test/clang-rename/ClassReplacements.cpp deleted file mode 100644 index 2b478bbf900..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassReplacements.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir -p %t/fixes -// RUN: cat %s > %t.cpp -// RUN: clang-rename -offset=254 -new-name=Bar -export-fixes=%t/fixes/clang-rename.yaml %t.cpp -- -// RUN: clang-apply-replacements %t -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s - -class Foo {}; // CHECK: class Bar {}; - -// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing -// this file. diff --git a/clang-tools-extra/test/clang-rename/ClassSimpleRenaming.cpp b/clang-tools-extra/test/clang-rename/ClassSimpleRenaming.cpp deleted file mode 100644 index 086f55736cb..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassSimpleRenaming.cpp +++ /dev/null @@ -1,14 +0,0 @@ -class Foo /* Test 1 */ { // CHECK: class Bar /* Test 1 */ { -public: - void foo(int x); -}; - -void Foo::foo(int x) /* Test 2 */ {} // CHECK: void Bar::foo(int x) /* Test 2 */ {} - -// Test 1. -// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=109 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/ClassTestMulti.cpp b/clang-tools-extra/test/clang-rename/ClassTestMulti.cpp deleted file mode 100644 index 81e65c76065..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassTestMulti.cpp +++ /dev/null @@ -1,11 +0,0 @@ -class Foo1 /* Offset 1 */ { // CHECK: class Bar1 /* Offset 1 */ { -}; - -class Foo2 /* Offset 2 */ { // CHECK: class Bar2 /* Offset 2 */ { -}; - -// Test 1. -// RUN: clang-rename -offset=6 -new-name=Bar1 -offset=76 -new-name=Bar2 %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/ClassTestMultiByName.cpp b/clang-tools-extra/test/clang-rename/ClassTestMultiByName.cpp deleted file mode 100644 index 61b69a1bdf4..00000000000 --- a/clang-tools-extra/test/clang-rename/ClassTestMultiByName.cpp +++ /dev/null @@ -1,8 +0,0 @@ -class Foo1 { // CHECK: class Bar1 -}; - -class Foo2 { // CHECK: class Bar2 -}; - -// Test 1. -// RUN: clang-rename -qualified-name=Foo1 -new-name=Bar1 -qualified-name=Foo2 -new-name=Bar2 %s -- | sed 's,//.*,,' | FileCheck %s diff --git a/clang-tools-extra/test/clang-rename/ComplexFunctionOverride.cpp b/clang-tools-extra/test/clang-rename/ComplexFunctionOverride.cpp deleted file mode 100644 index ccf3a20e540..00000000000 --- a/clang-tools-extra/test/clang-rename/ComplexFunctionOverride.cpp +++ /dev/null @@ -1,47 +0,0 @@ -struct A { - virtual void foo() {} /* Test 1 */ // CHECK: virtual void bar() {} -}; - -struct B : A { - void foo() override {} /* Test 2 */ // CHECK: void bar() override {} -}; - -struct C : B { - void foo() override {} /* Test 3 */ // CHECK: void bar() override {} -}; - -struct D : B { - void foo() override {} /* Test 4 */ // CHECK: void bar() override {} -}; - -struct E : D { - void foo() override {} /* Test 5 */ // CHECK: void bar() override {} -}; - -int main() { - A a; - a.foo(); // CHECK: a.bar(); - B b; - b.foo(); // CHECK: b.bar(); - C c; - c.foo(); // CHECK: c.bar(); - D d; - d.foo(); // CHECK: d.bar(); - E e; - e.foo(); // CHECK: e.bar(); - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=26 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=109 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=201 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 4. -// RUN: clang-rename -offset=293 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 5. -// RUN: clang-rename -offset=385 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/ComplicatedClassType.cpp b/clang-tools-extra/test/clang-rename/ComplicatedClassType.cpp deleted file mode 100644 index 88019530312..00000000000 --- a/clang-tools-extra/test/clang-rename/ComplicatedClassType.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Forward declaration. -class Foo; /* Test 1 */ // CHECK: class Bar; /* Test 1 */ - -class Baz { - virtual int getValue() const = 0; -}; - -class Foo : public Baz { /* Test 2 */// CHECK: class Bar : public Baz { -public: - Foo(int value = 0) : x(value) {} // CHECK: Bar(int value = 0) : x(value) {} - - Foo &operator++(int) { // CHECK: Bar &operator++(int) { - x++; - return *this; - } - - bool operator<(Foo const &rhs) { // CHECK: bool operator<(Bar const &rhs) { - return this->x < rhs.x; - } - - int getValue() const { - return 0; - } - -private: - int x; -}; - -int main() { - Foo *Pointer = 0; // CHECK: Bar *Pointer = 0; - Foo Variable = Foo(10); // CHECK: Bar Variable = Bar(10); - for (Foo it; it < Variable; it++) { // CHECK: for (Bar it; it < Variable; it++) { - } - const Foo *C = new Foo(); // CHECK: const Bar *C = new Bar(); - const_cast<Foo *>(C)->getValue(); // CHECK: const_cast<Bar *>(C)->getValue(); - Foo foo; // CHECK: Bar foo; - const Baz &BazReference = foo; - const Baz *BazPointer = &foo; - dynamic_cast<const Foo &>(BazReference).getValue(); /* Test 3 */ // CHECK: dynamic_cast<const Bar &>(BazReference).getValue(); - dynamic_cast<const Foo *>(BazPointer)->getValue(); /* Test 4 */ // CHECK: dynamic_cast<const Bar *>(BazPointer)->getValue(); - reinterpret_cast<const Foo *>(BazPointer)->getValue(); /* Test 5 */ // CHECK: reinterpret_cast<const Bar *>(BazPointer)->getValue(); - static_cast<const Foo &>(BazReference).getValue(); /* Test 6 */ // CHECK: static_cast<const Bar &>(BazReference).getValue(); - static_cast<const Foo *>(BazPointer)->getValue(); /* Test 7 */ // CHECK: static_cast<const Bar *>(BazPointer)->getValue(); - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=30 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=155 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=1133 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 4. -// RUN: clang-rename -offset=1266 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 5. -// RUN: clang-rename -offset=1402 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 6. -// RUN: clang-rename -offset=1533 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s -// Test 7. -// RUN: clang-rename -offset=1665 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/Ctor.cpp b/clang-tools-extra/test/clang-rename/Ctor.cpp deleted file mode 100644 index 9908a4123dd..00000000000 --- a/clang-tools-extra/test/clang-rename/Ctor.cpp +++ /dev/null @@ -1,14 +0,0 @@ -class Foo { // CHECK: class Bar { -public: - Foo(); /* Test 1 */ // CHECK: Bar(); -}; - -Foo::Foo() /* Test 2 */ {} // CHECK: Bar::Bar() /* Test 2 */ {} - -// Test 1. -// RUN: clang-rename -offset=62 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=116 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/CtorInitializer.cpp b/clang-tools-extra/test/clang-rename/CtorInitializer.cpp deleted file mode 100644 index fed4f5b06c2..00000000000 --- a/clang-tools-extra/test/clang-rename/CtorInitializer.cpp +++ /dev/null @@ -1,17 +0,0 @@ -class Baz {}; - -class Qux { - Baz Foo; /* Test 1 */ // CHECK: Baz Bar; -public: - Qux(); -}; - -Qux::Qux() : Foo() /* Test 2 */ {} // CHECK: Qux::Qux() : Bar() /* Test 2 */ {} - -// Test 1. -// RUN: clang-rename -offset=33 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=118 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/DeclRefExpr.cpp b/clang-tools-extra/test/clang-rename/DeclRefExpr.cpp deleted file mode 100644 index 6462862d82a..00000000000 --- a/clang-tools-extra/test/clang-rename/DeclRefExpr.cpp +++ /dev/null @@ -1,24 +0,0 @@ -class C { -public: - static int Foo; /* Test 1 */ // CHECK: static int Bar; -}; - -int foo(int x) { return 0; } -#define MACRO(a) foo(a) - -int main() { - C::Foo = 1; /* Test 2 */ // CHECK: C::Bar = 1; - MACRO(C::Foo); // CHECK: MACRO(C::Bar); - int y = C::Foo; /* Test 3 */ // CHECK: int y = C::Bar; - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=31 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=152 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=271 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/Field.cpp b/clang-tools-extra/test/clang-rename/Field.cpp deleted file mode 100644 index c0e9a019e47..00000000000 --- a/clang-tools-extra/test/clang-rename/Field.cpp +++ /dev/null @@ -1,15 +0,0 @@ -class Baz { - int Foo; /* Test 1 */ // CHECK: int Bar; -public: - Baz(); -}; - -Baz::Baz() : Foo(0) /* Test 2 */ {} // CHECK: Baz::Baz() : Bar(0) - -// Test 1. -// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=89 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/FunctionMacro.cpp b/clang-tools-extra/test/clang-rename/FunctionMacro.cpp deleted file mode 100644 index 6e87026ec70..00000000000 --- a/clang-tools-extra/test/clang-rename/FunctionMacro.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#define moo foo // CHECK: #define moo macro_function - -int foo() /* Test 1 */ { // CHECK: int macro_function() /* Test 1 */ { - return 42; -} - -void boo(int value) {} - -void qoo() { - foo(); // CHECK: macro_function(); - boo(foo()); // CHECK: boo(macro_function()); - moo(); - boo(moo()); -} - -// Test 1. -// RUN: clang-rename -offset=68 -new-name=macro_function %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/FunctionOverride.cpp b/clang-tools-extra/test/clang-rename/FunctionOverride.cpp deleted file mode 100644 index adfeb739e66..00000000000 --- a/clang-tools-extra/test/clang-rename/FunctionOverride.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class A { virtual void foo(); /* Test 1 */ }; // CHECK: class A { virtual void bar(); -class B : public A { void foo(); /* Test 2 */ }; // CHECK: class B : public A { void bar(); -class C : public B { void foo(); /* Test 3 */ }; // CHECK: class C : public B { void bar(); - -// Test 1. -// RUN: clang-rename -offset=23 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=116 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=209 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/FunctionWithClassFindByName.cpp b/clang-tools-extra/test/clang-rename/FunctionWithClassFindByName.cpp deleted file mode 100644 index 2cae09a1c24..00000000000 --- a/clang-tools-extra/test/clang-rename/FunctionWithClassFindByName.cpp +++ /dev/null @@ -1,12 +0,0 @@ -void foo() { -} - -class Foo { // CHECK: class Bar -}; - -int main() { - Foo *Pointer = 0; // CHECK: Bar *Pointer = 0; - return 0; -} - -// RUN: clang-rename -qualified-name=Foo -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s diff --git a/clang-tools-extra/test/clang-rename/IncludeHeaderWithSymbol.cpp b/clang-tools-extra/test/clang-rename/IncludeHeaderWithSymbol.cpp deleted file mode 100644 index cb2baee57b8..00000000000 --- a/clang-tools-extra/test/clang-rename/IncludeHeaderWithSymbol.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "Inputs/HeaderWithSymbol.h" - -int main() { - return 0; // CHECK: {{^ return 0;}} -} - -// Test 1. -// The file IncludeHeaderWithSymbol.cpp doesn't contain the symbol Foo -// and is expected to be written to stdout without modifications -// RUN: clang-rename -qualified-name=Foo -new-name=Bar %s -- | FileCheck %s diff --git a/clang-tools-extra/test/clang-rename/Inputs/HeaderWithSymbol.h b/clang-tools-extra/test/clang-rename/Inputs/HeaderWithSymbol.h deleted file mode 100644 index 1fe02e89786..00000000000 --- a/clang-tools-extra/test/clang-rename/Inputs/HeaderWithSymbol.h +++ /dev/null @@ -1 +0,0 @@ -struct Foo {}; diff --git a/clang-tools-extra/test/clang-rename/Inputs/OffsetToNewName.yaml b/clang-tools-extra/test/clang-rename/Inputs/OffsetToNewName.yaml deleted file mode 100644 index d8e972880f3..00000000000 --- a/clang-tools-extra/test/clang-rename/Inputs/OffsetToNewName.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- Offset: 6 - NewName: Bar1 -- Offset: 44 - NewName: Bar2 -... diff --git a/clang-tools-extra/test/clang-rename/Inputs/QualifiedNameToNewName.yaml b/clang-tools-extra/test/clang-rename/Inputs/QualifiedNameToNewName.yaml deleted file mode 100644 index 6e3783671df..00000000000 --- a/clang-tools-extra/test/clang-rename/Inputs/QualifiedNameToNewName.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- QualifiedName: Foo1 - NewName: Bar1 -- QualifiedName: Foo2 - NewName: Bar2 -... diff --git a/clang-tools-extra/test/clang-rename/InvalidNewName.cpp b/clang-tools-extra/test/clang-rename/InvalidNewName.cpp deleted file mode 100644 index e6b38e59420..00000000000 --- a/clang-tools-extra/test/clang-rename/InvalidNewName.cpp +++ /dev/null @@ -1,2 +0,0 @@ -// RUN: not clang-rename -new-name=class -offset=133 %s 2>&1 | FileCheck %s -// CHECK: ERROR: new name is not a valid identifier in C++17. diff --git a/clang-tools-extra/test/clang-rename/InvalidOffset.cpp b/clang-tools-extra/test/clang-rename/InvalidOffset.cpp deleted file mode 100644 index 2ae04d01e4a..00000000000 --- a/clang-tools-extra/test/clang-rename/InvalidOffset.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Inputs/HeaderWithSymbol.h" -#define FOO int bar; -FOO - -int foo; - -// RUN: not clang-rename -new-name=qux -offset=259 %s -- 2>&1 | FileCheck %s -// CHECK-NOT: CHECK -// CHECK: error: SourceLocation in file {{.*}}InvalidOffset.cpp at offset 259 is invalid diff --git a/clang-tools-extra/test/clang-rename/InvalidQualifiedName.cpp b/clang-tools-extra/test/clang-rename/InvalidQualifiedName.cpp deleted file mode 100644 index 5280e3939cc..00000000000 --- a/clang-tools-extra/test/clang-rename/InvalidQualifiedName.cpp +++ /dev/null @@ -1,4 +0,0 @@ -struct S { -}; - -// RUN: clang-rename -force -qualified-name S2 -new-name=T %s -- diff --git a/clang-tools-extra/test/clang-rename/MemberExprMacro.cpp b/clang-tools-extra/test/clang-rename/MemberExprMacro.cpp deleted file mode 100644 index 56cd8d95f6e..00000000000 --- a/clang-tools-extra/test/clang-rename/MemberExprMacro.cpp +++ /dev/null @@ -1,22 +0,0 @@ -class Baz { -public: - int Foo; /* Test 1 */ // CHECK: int Bar; -}; - -int qux(int x) { return 0; } -#define MACRO(a) qux(a) - -int main() { - Baz baz; - baz.Foo = 1; /* Test 2 */ // CHECK: baz.Bar = 1; - MACRO(baz.Foo); // CHECK: MACRO(baz.Bar); - int y = baz.Foo; // CHECK: int y = baz.Bar; -} - -// Test 1. -// RUN: clang-rename -offset=26 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=155 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/Namespace.cpp b/clang-tools-extra/test/clang-rename/Namespace.cpp deleted file mode 100644 index ec9630fdedb..00000000000 --- a/clang-tools-extra/test/clang-rename/Namespace.cpp +++ /dev/null @@ -1,13 +0,0 @@ -namespace gcc /* Test 1 */ { // CHECK: namespace clang /* Test 1 */ { - int x; -} - -void boo() { - gcc::x = 42; // CHECK: clang::x = 42; -} - -// Test 1. -// RUN: clang-rename -offset=10 -new-name=clang %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/NoNewName.cpp b/clang-tools-extra/test/clang-rename/NoNewName.cpp deleted file mode 100644 index 4f882d83b0c..00000000000 --- a/clang-tools-extra/test/clang-rename/NoNewName.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// Check for an error while -new-name argument has not been passed to -// clang-rename. -// RUN: not clang-rename -offset=133 %s 2>&1 | FileCheck %s -// CHECK: clang-rename: -new-name must be specified. diff --git a/clang-tools-extra/test/clang-rename/TemplateClassInstantiation.cpp b/clang-tools-extra/test/clang-rename/TemplateClassInstantiation.cpp deleted file mode 100644 index 493d0951df5..00000000000 --- a/clang-tools-extra/test/clang-rename/TemplateClassInstantiation.cpp +++ /dev/null @@ -1,42 +0,0 @@ -template <typename T> -class Foo { /* Test 1 */ // CHECK: class Bar { /* Test 1 */ -public: - T foo(T arg, T& ref, T* ptr) { - T value; - int number = 42; - value = (T)number; - value = static_cast<T>(number); - return value; - } - static void foo(T value) {} - T member; -}; - -template <typename T> -void func() { - Foo<T> obj; /* Test 2 */ // CHECK: Bar<T> obj; - obj.member = T(); - Foo<T>::foo(); // CHECK: Bar<T>::foo(); -} - -int main() { - Foo<int> i; /* Test 3 */ // CHECK: Bar<int> i; - i.member = 0; - Foo<int>::foo(0); // CHECK: Bar<int>::foo(0); - - Foo<bool> b; // CHECK: Bar<bool> b; - b.member = false; - Foo<bool>::foo(false); // CHECK: Bar<bool>::foo(false); - - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=29 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=324 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=463 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/TemplateTypename.cpp b/clang-tools-extra/test/clang-rename/TemplateTypename.cpp deleted file mode 100644 index 559ec1f9ade..00000000000 --- a/clang-tools-extra/test/clang-rename/TemplateTypename.cpp +++ /dev/null @@ -1,24 +0,0 @@ -template <typename T /* Test 1 */> // CHECK: template <typename U /* Test 1 */> -class Foo { -T foo(T arg, T& ref, T* /* Test 2 */ ptr) { // CHECK: U foo(U arg, U& ref, U* /* Test 2 */ ptr) { - T value; // CHECK: U value; - int number = 42; - value = (T)number; // CHECK: value = (U)number; - value = static_cast<T /* Test 3 */>(number); // CHECK: value = static_cast<U /* Test 3 */>(number); - return value; -} - -static void foo(T value) {} // CHECK: static void foo(U value) {} - -T member; // CHECK: U member; -}; - -// Test 1. -// RUN: clang-rename -offset=19 -new-name=U %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=126 -new-name=U %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=392 -new-name=U %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'T.*' <file> diff --git a/clang-tools-extra/test/clang-rename/TemplatedClassFunction.cpp b/clang-tools-extra/test/clang-rename/TemplatedClassFunction.cpp deleted file mode 100644 index 1f5b0b52ba7..00000000000 --- a/clang-tools-extra/test/clang-rename/TemplatedClassFunction.cpp +++ /dev/null @@ -1,22 +0,0 @@ -template <typename T> -class A { -public: - void foo() /* Test 1 */ {} // CHECK: void bar() /* Test 1 */ {} -}; - -int main(int argc, char **argv) { - A<int> a; - a.foo(); /* Test 2 */ // CHECK: a.bar() /* Test 2 */ - return 0; -} - -// Test 1. -// RUN: clang-refactor rename -offset=48 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-refactor rename -offset=162 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s -// -// Currently unsupported test. -// XFAIL: * - -// To find offsets after modifying the file, use: -// grep -Ubo 'foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/UserDefinedConversion.cpp b/clang-tools-extra/test/clang-rename/UserDefinedConversion.cpp deleted file mode 100644 index 60f251ab448..00000000000 --- a/clang-tools-extra/test/clang-rename/UserDefinedConversion.cpp +++ /dev/null @@ -1,26 +0,0 @@ -class Foo { /* Test 1 */ // CHECK: class Bar { -public: - Foo() {} // CHECK: Bar() {} -}; - -class Baz { -public: - operator Foo() /* Test 2 */ const { // CHECK: operator Bar() /* Test 2 */ const { - Foo foo; // CHECK: Bar foo; - return foo; - } -}; - -int main() { - Baz boo; - Foo foo = static_cast<Foo>(boo); // CHECK: Bar foo = static_cast<Bar>(boo); - return 0; -} - -// Test 1. -// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=164 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/Variable.cpp b/clang-tools-extra/test/clang-rename/Variable.cpp deleted file mode 100644 index d7e670fb43e..00000000000 --- a/clang-tools-extra/test/clang-rename/Variable.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#define NAMESPACE namespace A -NAMESPACE { -int Foo; /* Test 1 */ // CHECK: int Bar; -} -int Foo; // CHECK: int Foo; -int Qux = Foo; // CHECK: int Qux = Foo; -int Baz = A::Foo; /* Test 2 */ // CHECK: Baz = A::Bar; -void fun() { - struct { - int Foo; // CHECK: int Foo; - } b = {100}; - int Foo = 100; // CHECK: int Foo = 100; - Baz = Foo; // CHECK: Baz = Foo; - { - extern int Foo; // CHECK: extern int Foo; - Baz = Foo; // CHECK: Baz = Foo; - Foo = A::Foo /* Test 3 */ + Baz; // CHECK: Foo = A::Bar /* Test 3 */ + Baz; - A::Foo /* Test 4 */ = b.Foo; // CHECK: A::Bar /* Test 4 */ = b.Foo; - } - Foo = b.Foo; // Foo = b.Foo; -} - -// Test 1. -// RUN: clang-rename -offset=46 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=234 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=641 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 4. -// RUN: clang-rename -offset=716 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/VariableMacro.cpp b/clang-tools-extra/test/clang-rename/VariableMacro.cpp deleted file mode 100644 index 622e825d3e4..00000000000 --- a/clang-tools-extra/test/clang-rename/VariableMacro.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#define Baz Foo // CHECK: #define Baz Bar - -void foo(int value) {} - -void macro() { - int Foo; /* Test 1 */ // CHECK: int Bar; - Foo = 42; /* Test 2 */ // CHECK: Bar = 42; - Baz -= 0; - foo(Foo); /* Test 3 */ // CHECK: foo(Bar); - foo(Baz); -} - -// Test 1. -// RUN: clang-rename -offset=88 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=129 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 3. -// RUN: clang-rename -offset=191 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> diff --git a/clang-tools-extra/test/clang-rename/YAMLInput.cpp b/clang-tools-extra/test/clang-rename/YAMLInput.cpp deleted file mode 100644 index 55dbc6d66a5..00000000000 --- a/clang-tools-extra/test/clang-rename/YAMLInput.cpp +++ /dev/null @@ -1,10 +0,0 @@ -class Foo1 { // CHECK: class Bar1 -}; - -class Foo2 { // CHECK: class Bar2 -}; - -// Test 1. -// RUN: clang-rename -input %S/Inputs/OffsetToNewName.yaml %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -input %S/Inputs/QualifiedNameToNewName.yaml %s -- | sed 's,//.*,,' | FileCheck %s |

