On Wed, Aug 10, 2016 at 9:28 AM, Kirill Bobyrev via cfe-commits <cfe-commits@lists.llvm.org> wrote: > Author: omtcyfz > Date: Wed Aug 10 08:28:30 2016 > New Revision: 278221 > > URL: http://llvm.org/viewvc/llvm-project?rev=278221&view=rev > Log: > [clang-rename] merge tests when possible > > The only difference between some tests is -offset passed to clang-rename. It > makes sense to merge them into a single file and add multiple tool > invocations.
This appears to have broken some of the bots. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/9739/steps/test/logs/stdio http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/18013/steps/test/logs/stdio ~Aaron > > Reviewers: alexfh > > Differential Revision: https://reviews.llvm.org/D23158 > > Added: > clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgument.cpp > clang-tools-extra/trunk/test/clang-rename/Ctor.cpp > Modified: > clang-tools-extra/trunk/test/clang-rename/ClassFindByName.cpp > clang-tools-extra/trunk/test/clang-rename/ClassSimpleRenaming.cpp > clang-tools-extra/trunk/test/clang-rename/ClassTestMulti.cpp > clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByName.cpp > clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByNameYAML.cpp > clang-tools-extra/trunk/test/clang-rename/ComplexFunctionOverride.cpp > clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp > clang-tools-extra/trunk/test/clang-rename/CtorInitializer.cpp > clang-tools-extra/trunk/test/clang-rename/DeclRefExpr.cpp > clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp > clang-tools-extra/trunk/test/clang-rename/FunctionOverride.cpp > clang-tools-extra/trunk/test/clang-rename/FunctionWithClassFindByName.cpp > clang-tools-extra/trunk/test/clang-rename/MemberExprMacro.cpp > clang-tools-extra/trunk/test/clang-rename/Namespace.cpp > clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiation.cpp > clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp > clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp > clang-tools-extra/trunk/test/clang-rename/Variable.cpp > clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp > > Added: clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgument.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgument.cpp?rev=278221&view=auto > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgument.cpp > (added) > +++ clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgument.cpp Wed > Aug 10 08:28:30 2016 > @@ -0,0 +1,21 @@ > +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> > > Modified: clang-tools-extra/trunk/test/clang-rename/ClassFindByName.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassFindByName.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassFindByName.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/ClassFindByName.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,11 +1,10 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > -class Foo { // CHECK: class Bar > +class Foo { // CHECK: class Bar { > }; > > int main() { > Foo *Pointer = 0; // CHECK: Bar *Pointer = 0; > return 0; > } > + > +// Test 1. > +// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %s -- | sed > 's,//.*,,' | FileCheck %s > > Modified: clang-tools-extra/trunk/test/clang-rename/ClassSimpleRenaming.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassSimpleRenaming.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassSimpleRenaming.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/ClassSimpleRenaming.cpp Wed Aug > 10 08:28:30 2016 > @@ -1,13 +1,14 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=136 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > +class Foo /* Test 1 */ { // CHECK: class Bar /* Test 1 */ { > +public: > + void foo(int x); > +}; > > -class Foo {}; // CHECK: class Bar > +void Foo::foo(int x) /* Test 2 */ {} // CHECK: void Bar::foo(int x) /* Test > 2 */ {} > > -int main() { > - Foo *Pointer = 0; // CHECK: Bar *Pointer = 0; > - return 0; > -} > +// 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 > > -// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing > -// this file. > +// To find offsets after modifying the file, use: > +// grep -Ubo 'Foo.*' <file> > > Modified: clang-tools-extra/trunk/test/clang-rename/ClassTestMulti.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTestMulti.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassTestMulti.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/ClassTestMulti.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,8 +1,11 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename rename-all -offset=174 -new-name=Bar1 -offset=212 > -new-name=Bar2 %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > -class Foo1 { // CHECK: class Bar1 > +class Foo1 /* Offset 1 */ { // CHECK: class Bar1 /* Offset 1 */ { > }; > > -class Foo2 { // CHECK: class Bar2 > +class Foo2 /* Offset 2 */ { // CHECK: class Bar2 /* Offset 2 */ { > }; > + > +// Test 1. > +// RUN: clang-rename rename-all -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> > > Modified: clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByName.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByName.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByName.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByName.cpp Wed > Aug 10 08:28:30 2016 > @@ -1,8 +1,8 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename rename-all -old-name=Foo1 -new-name=Bar1 -old-name=Foo2 > -new-name=Bar2 %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > class Foo1 { // CHECK: class Bar1 > }; > > class Foo2 { // CHECK: class Bar2 > }; > + > +// Test 1. > +// RUN: clang-rename rename-all -old-name=Foo1 -new-name=Bar1 -old-name=Foo2 > -new-name=Bar2 %s -- | sed 's,//.*,,' | FileCheck %s > > Modified: > clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByNameYAML.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByNameYAML.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByNameYAML.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/ClassTestMultiByNameYAML.cpp > Wed Aug 10 08:28:30 2016 > @@ -3,5 +3,8 @@ class Foo1 { // CHECK: class Bar1 > > class Foo2 { // CHECK: class Bar2 > }; > + > +// Test 1. > // RUN: clang-rename rename-all -input > %S/Inputs/ClassTestMultiByNameYAMLRenameAll.yaml %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 2. > // RUN: clang-rename rename-all -input > %S/Inputs/ClassTestMultiByNameYAMLRenameAt.yaml %s -- | sed 's,//.*,,' | > FileCheck %s > > Modified: > clang-tools-extra/trunk/test/clang-rename/ComplexFunctionOverride.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ComplexFunctionOverride.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ComplexFunctionOverride.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/ComplexFunctionOverride.cpp Wed > Aug 10 08:28:30 2016 > @@ -1,23 +1,47 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=307 -new-name=bar %t.cpp -i -- -std=c++11 > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > struct A { > - virtual void foo(); // CHECK: virtual void bar(); > + virtual void foo() {} /* Test 1 */ // CHECK: virtual void bar() {} > }; > > struct B : A { > - void foo() override; // CHECK: void bar() override; > + void foo() override {} /* Test 2 */ // CHECK: void bar() override {} > }; > > struct C : B { > - void foo() override; // CHECK: void bar() override; > + void foo() override {} /* Test 3 */ // CHECK: void bar() override {} > }; > > struct D : B { > - void foo() override; // CHECK: void bar() override; > + void foo() override {} /* Test 4 */ // CHECK: void bar() override {} > }; > > struct E : D { > - void foo() override; // CHECK: void bar() override; > + 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp Wed > Aug 10 08:28:30 2016 > @@ -1,11 +1,11 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=220 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > // Forward declaration. > -class Foo; // CHECK: class Bar; > +class Foo; /* Test 1 */ // CHECK: class Bar; /* Test 1 */ > + > +class Baz { > + virtual int getValue() const = 0; > +}; > > -class Foo { // CHECK: class Bar { > +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) {} > > @@ -18,6 +18,10 @@ public: > return this->x < rhs.x; > } > > + int getValue() const { > + return 0; > + } > + > private: > int x; > }; > @@ -27,5 +31,33 @@ int main() { > 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 -- | sed 's,//.*,,' | > FileCheck %s > +// Test 2. > +// RUN: clang-rename -offset=155 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 3. > +// RUN: clang-rename -offset=1133 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 4. > +// RUN: clang-rename -offset=1266 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 5. > +// RUN: clang-rename -offset=1402 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 6. > +// RUN: clang-rename -offset=1533 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 7. > +// RUN: clang-rename -offset=1665 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > + > +// To find offsets after modifying the file, use: > +// grep -Ubo 'Foo.*' <file> > > Added: clang-tools-extra/trunk/test/clang-rename/Ctor.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/Ctor.cpp?rev=278221&view=auto > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/Ctor.cpp (added) > +++ clang-tools-extra/trunk/test/clang-rename/Ctor.cpp Wed Aug 10 08:28:30 > 2016 > @@ -0,0 +1,14 @@ > +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> > > Modified: clang-tools-extra/trunk/test/clang-rename/CtorInitializer.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/CtorInitializer.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/CtorInitializer.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/CtorInitializer.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,16 +1,17 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=163 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > class Baz {}; > > class Qux { > - Baz Foo; // CHECK: Baz Bar; > + Baz Foo; /* Test 1 */ // CHECK: Baz Bar; > public: > Qux(); > }; > > -Qux::Qux() : Foo() {} // CHECK: Qux::Qux() : Bar() {} > +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 > > -// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing > -// this file. > +// To find offsets after modifying the file, use: > +// grep -Ubo 'Foo.*' <file> > > Modified: clang-tools-extra/trunk/test/clang-rename/DeclRefExpr.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DeclRefExpr.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/DeclRefExpr.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/DeclRefExpr.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,20 +1,24 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=161 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > class C { > public: > - static int Foo; // CHECK: static int Bar; > + 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; // CHECK: C::Bar > - MACRO(C::Foo); // CHECK: C::Bar > - int y = C::Foo; // CHECK: C::Bar > + 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; > } > > -// Use grep -FUbo 'X' <file> to get the correct offset of foo when changing > -// this file. > +// 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,21 +1,20 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=199 -new-name=macro_function %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > +#define moo foo // CHECK: #define moo macro_function > > -#define moo foo // CHECK: #define moo macro_function > - > -int foo() { // CHECK: int 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()); > + foo(); // CHECK: macro_function(); > + boo(foo()); // CHECK: boo(macro_function()); > moo(); > boo(moo()); > } > > -// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when > changing > -// this file. > +// 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/FunctionOverride.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/FunctionOverride.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/FunctionOverride.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/FunctionOverride.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,10 +1,13 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=318 -new-name=bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > +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(); > > -class A { virtual void foo(); }; // CHECK: class A { virtual void bar(); > }; > -class B : public A { void foo(); }; // CHECK: class B : public A { void > bar(); }; > -class C : public B { void foo(); }; // 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 > > -// Use grep -FUbo 'Foo' <file> to get the correct offset of Foo when changing > -// this file. > +// To find offsets after modifying the file, use: > +// grep -Ubo 'foo.*' <file> > > Modified: > clang-tools-extra/trunk/test/clang-rename/FunctionWithClassFindByName.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/FunctionWithClassFindByName.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/FunctionWithClassFindByName.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/FunctionWithClassFindByName.cpp > Wed Aug 10 08:28:30 2016 > @@ -1,7 +1,3 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > void foo() { > } > > @@ -13,3 +9,4 @@ int main() { > return 0; > } > > +// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %s -- | sed > 's,//.*,,' | FileCheck %s > > Modified: clang-tools-extra/trunk/test/clang-rename/MemberExprMacro.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/MemberExprMacro.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/MemberExprMacro.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/MemberExprMacro.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,10 +1,6 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=156 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > class Baz { > public: > - int Foo; // CHECK: int Bar; > + int Foo; /* Test 1 */ // CHECK: int Bar; > }; > > int qux(int x) { return 0; } > @@ -12,10 +8,15 @@ int qux(int x) { return 0; } > > int main() { > Baz baz; > - baz.Foo = 1; // CHECK: baz.Bar = 1; > - MACRO(baz.Foo); // CHECK: MACRO(baz.Bar); > - int y = baz.Foo; // CHECK: int y = baz.Bar; > + 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; > } > > -// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing > -// this file. > +// 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/Namespace.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/Namespace.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/Namespace.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/Namespace.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,14 +1,13 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=143 -new-name=llvm %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > -namespace foo { // CHECK: namespace llvm { > +namespace gcc /* Test 1 */ { // CHECK: namespace clang /* Test 1 */ { > int x; > } > > void boo() { > - foo::x = 42; // CHECK: llvm::x = 42; > + gcc::x = 42; // CHECK: clang::x = 42; > } > > -// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when > changing > -// this file. > +// 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> > > Modified: > clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiation.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiation.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiation.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiation.cpp > Wed Aug 10 08:28:30 2016 > @@ -1,5 +1,5 @@ > template <typename T> > -class Foo { // CHECK: class Bar { > +class Foo { /* Test 1 */ // CHECK: class Bar { /* Test 1 */ > public: > T foo(T arg, T& ref, T* ptr) { > T value; > @@ -14,31 +14,29 @@ public: > > template <typename T> > void func() { > - Foo<T> obj; // CHECK: Bar<T> obj; > + Foo<T> obj; /* Test 2 */ // CHECK: Bar<T> obj; > obj.member = T(); > - Foo<T>::foo(); // CHECK: Bar<T>::foo(); > + Foo<T>::foo(); // CHECK: Bar<T>::foo(); > } > > int main() { > - Foo<int> i; // CHECK: Bar<int> i; > + Foo<int> i; /* Test 3 */ // CHECK: Bar<int> i; > i.member = 0; > - Foo<int>::foo(0); // CHECK: Bar<int>::foo(0); > + Foo<int>::foo(0); // CHECK: Bar<int>::foo(0); > > - Foo<bool> b; // CHECK: Bar<bool> b; > + Foo<bool> b; // CHECK: Bar<bool> b; > b.member = false; > - Foo<bool>::foo(false); // CHECK: Bar<bool>::foo(false); > + Foo<bool>::foo(false); // CHECK: Bar<bool>::foo(false); > > return 0; > } > > -// RUN: cat %s > %t-0.cpp > -// RUN: clang-rename -offset=29 -new-name=Bar %t-0.cpp -i -- > -fno-delayed-template-parsing > -// RUN: sed 's,//.*,,' %t-0.cpp | FileCheck %s > - > -// RUN: cat %s > %t-1.cpp > -// RUN: clang-rename -offset=311 -new-name=Bar %t-1.cpp -i -- > -fno-delayed-template-parsing > -// RUN: sed 's,//.*,,' %t-1.cpp | FileCheck %s > - > -// RUN: cat %s > %t-2.cpp > -// RUN: clang-rename -offset=445 -new-name=Bar %t-2.cpp -i -- > -fno-delayed-template-parsing > -// RUN: sed 's,//.*,,' %t-2.cpp | FileCheck %s > +// 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,12 +1,24 @@ > -// Currently unsupported test. > -// RUN: cat %s > %t.cpp > -// FIXME: clang-rename should be able to rename template parameters > correctly. > - > -template <typename T> > -T foo(T arg, T& ref, T* ptr) { > - T value; > +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; > - value = static_cast<T>(number); > + 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> > > Modified: clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp > (original) > +++ clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp Wed > Aug 10 08:28:30 2016 > @@ -1,13 +1,26 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=205 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > -class Foo {}; // CHECK: class Bar {}; > +class Foo { /* Test 1 */ // CHECK: class Bar { > +public: > + Foo() {} // CHECK: Bar() {} > +}; > > class Baz { > - operator Foo() const { // CHECK: operator Bar() const { > -// offset ^ > - Foo foo; // CHECK: Bar foo; > +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> > > Modified: clang-tools-extra/trunk/test/clang-rename/Variable.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/Variable.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/Variable.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/Variable.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,27 +1,32 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=148 -new-name=Bar %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > namespace A { > -int Foo; // CHECK: int Bar; > +int Foo; /* Test 1 */ // CHECK: int Bar; > } > -int Foo; // CHECK: int Foo; > -int Qux = Foo; // CHECK: int Qux = Foo; > -int Baz = A::Foo; // CHECK: Baz = A::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; > + int Foo; // CHECK: int Foo; > } b = {100}; > - int Foo = 100; // CHECK: int Foo = 100; > - Baz = Foo; // CHECK: Baz = Foo; > + 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 + Baz; // CHECK: Foo = A::Bar + Baz; > - A::Foo = b.Foo; // CHECK: A::Bar = b.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; > + Foo = b.Foo; // Foo = b.Foo; > } > > -// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing > -// this file. > +// Test 1. > +// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 2. > +// RUN: clang-rename -offset=206 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 3. > +// RUN: clang-rename -offset=613 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > +// Test 4. > +// RUN: clang-rename -offset=688 -new-name=Bar %s -- | sed 's,//.*,,' | > FileCheck %s > + > +// To find offsets after modifying the file, use: > +// grep -Ubo 'Foo.*' <file> > > Modified: clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp?rev=278221&r1=278220&r2=278221&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp (original) > +++ clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp Wed Aug 10 > 08:28:30 2016 > @@ -1,18 +1,21 @@ > -// RUN: cat %s > %t.cpp > -// RUN: clang-rename -offset=208 -new-name=Z %t.cpp -i -- > -// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s > - > -#define Y X // CHECK: #define Y Z > +#define Baz Foo // CHECK: #define Baz Bar > > void foo(int value) {} > > void macro() { > - int X; // CHECK: int Z; > - X = 42; // CHECK: Z = 42; > - Y -= 0; > - foo(X); // CHECK: foo(Z); > - foo(Y); > + 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); > } > > -// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when > changing > -// this file. > +// 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> > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits