omtcyfz updated this revision to Diff 66818.
omtcyfz added a comment.

Make testset great again.


https://reviews.llvm.org/D23158

Files:
  test/clang-rename/ClassAsTemplateArgument.cpp
  test/clang-rename/ClassAsTemplateArgumentFindByClass.cpp
  test/clang-rename/ClassAsTemplateArgumentFindByTemplateArgument.cpp
  test/clang-rename/ClassFindByName.cpp
  test/clang-rename/ClassNameInFunctionDefinition.cpp
  test/clang-rename/ClassSimpleRenaming.cpp
  test/clang-rename/ClassTestMulti.cpp
  test/clang-rename/ClassTestMultiByName.cpp
  test/clang-rename/ComplexFunctionOverride.cpp
  test/clang-rename/ComplicatedClassType.cpp
  test/clang-rename/ConstCastExpr.cpp
  test/clang-rename/ConstructExpr.cpp
  test/clang-rename/Ctor.cpp
  test/clang-rename/CtorFindByDeclaration.cpp
  test/clang-rename/CtorFindByDefinition.cpp
  test/clang-rename/CtorInitializer.cpp
  test/clang-rename/DeclRefExpr.cpp
  test/clang-rename/Dtor.cpp
  test/clang-rename/DtorDeclaration.cpp
  test/clang-rename/DtorDefinition.cpp
  test/clang-rename/DynamicCastExpr.cpp
  test/clang-rename/Field.cpp
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/FunctionOverride.cpp
  test/clang-rename/FunctionWithClassFindByName.cpp
  test/clang-rename/MemberExprMacro.cpp
  test/clang-rename/Namespace.cpp
  test/clang-rename/NoNewName.cpp
  test/clang-rename/ReinterpretCastExpr.cpp
  test/clang-rename/StaticCastExpr.cpp
  test/clang-rename/TemplateClassInstantiation.cpp
  test/clang-rename/TemplateFunction.cpp
  test/clang-rename/TemplateFunctionFindByDeclaration.cpp
  test/clang-rename/TemplateFunctionFindByUse.cpp
  test/clang-rename/TemplateTypename.cpp
  test/clang-rename/TemplateTypenameFindByTemplateParam.cpp
  test/clang-rename/TemplateTypenameFindByTypeInside.cpp
  test/clang-rename/UserDefinedConversion.cpp
  test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp
  test/clang-rename/Variable.cpp
  test/clang-rename/VariableMacro.cpp

Index: test/clang-rename/VariableMacro.cpp
===================================================================
--- test/clang-rename/VariableMacro.cpp
+++ test/clang-rename/VariableMacro.cpp
@@ -1,18 +1,15 @@
-// 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;    // CHECK: int Bar;
+  Foo = 42;   // CHECK: Bar = 42;
+  Baz -= 0;
+  foo(Foo);   // CHECK: foo(Bar);
+  foo(Baz);
 }
 
-// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=88 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=117 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=167 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/Variable.cpp
===================================================================
--- test/clang-rename/Variable.cpp
+++ test/clang-rename/Variable.cpp
@@ -1,7 +1,3 @@
-// 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;
 }
@@ -23,5 +19,7 @@
   Foo = b.Foo;          // Foo = b.Foo;
 }
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=164 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=487 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=535 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp
===================================================================
--- test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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 {                         // CHECK: class Bar {
-//    ^ offset must be here
-public:
-  Foo() {}                          // CHECK: Bar() {}
-};
-
-class Baz {
-public:
-  operator Foo() const {            // CHECK: operator Bar() 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;
-}
-
-// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing
-// this file.
Index: test/clang-rename/UserDefinedConversion.cpp
===================================================================
--- test/clang-rename/UserDefinedConversion.cpp
+++ test/clang-rename/UserDefinedConversion.cpp
@@ -1,13 +1,21 @@
-// 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 {                         // 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() const {            // CHECK: operator Bar() 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;
+}
+
+// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=156 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/TemplateTypenameFindByTypeInside.cpp
===================================================================
--- test/clang-rename/TemplateTypenameFindByTypeInside.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-template <typename T>             // CHECK: template <typename U>
-class Foo {
-T foo(T arg, T& ref, T* ptr) {    // CHECK: U foo(U arg, U& ref, U* ptr) {
-  T value;                        // CHECK: U value;
-  int number = 42;
-  value = (T)number;              // CHECK: value = (U)number;
-  value = static_cast<T>(number); // CHECK: value = static_cast<U>(number);
-  return value;
-}
-
-static void foo(T value) {}       // CHECK: static void foo(U value) {}
-
-T member;                         // CHECK: U member;
-};
-
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=99 -new-name=U %t.cpp -i -- -fno-delayed-template-parsing
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
Index: test/clang-rename/TemplateTypenameFindByTemplateParam.cpp
===================================================================
--- test/clang-rename/TemplateTypenameFindByTemplateParam.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-template <typename T>             // CHECK: template <typename U>
-class Foo {
-T foo(T arg, T& ref, T* ptr) {    // CHECK: U foo(U arg, U& ref, U* ptr) {
-  T value;                        // CHECK: U value;
-  int number = 42;
-  value = (T)number;              // CHECK: value = (U)number;
-  value = static_cast<T>(number); // CHECK: value = static_cast<U>(number);
-  return value;
-}
-
-static void foo(T value) {}       // CHECK: static void foo(U value) {}
-
-T member;                         // CHECK: U member;
-};
-
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=19 -new-name=U %t.cpp -i -- -fno-delayed-template-parsing
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
Index: test/clang-rename/TemplateTypename.cpp
===================================================================
--- test/clang-rename/TemplateTypename.cpp
+++ test/clang-rename/TemplateTypename.cpp
@@ -1,12 +1,17 @@
-// 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>             // CHECK: template <typename U>
+class Foo {
+T foo(T arg, T& ref, T* ptr) {    // CHECK: U foo(U arg, U& ref, U* 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>(number); // CHECK: value = static_cast<U>(number);
   return value;
 }
+
+static void foo(T value) {}       // CHECK: static void foo(U value) {}
+
+T member;                         // CHECK: U member;
+};
+
+// RUN: clang-rename -offset=19 -new-name=U %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=99 -new-name=U %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/TemplateFunctionFindByUse.cpp
===================================================================
--- test/clang-rename/TemplateFunctionFindByUse.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=233 -new-name=bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-template <typename T>
-T foo(T value) {    // CHECK: T bar(T value) {
-  return value;
-}
-
-int main() {
-  foo<bool>(false); // CHECK: bar<bool>(false);
-  foo<int>(0);      // CHECK: bar<int>(0);
-  return 0;
-}
Index: test/clang-rename/TemplateFunctionFindByDeclaration.cpp
===================================================================
--- test/clang-rename/TemplateFunctionFindByDeclaration.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=154 -new-name=bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-template <typename T>
-T foo(T value) {    // CHECK: T bar(T value) {
-  return value;
-}
-
-int main() {
-  foo<bool>(false); // CHECK: bar<bool>(false);
-  foo<int>(0);      // CHECK: bar<int>(0);
-  return 0;
-}
-
-// Use grep -FUbo 'foo' <file> to get the correct offset of foo when changing
-// this file.
Index: test/clang-rename/TemplateFunction.cpp
===================================================================
--- /dev/null
+++ test/clang-rename/TemplateFunction.cpp
@@ -0,0 +1,13 @@
+template <typename T>
+T foo(T value) {    // CHECK: T bar(T value) {
+  return value;
+}
+
+int main() {
+  foo<bool>(false); // CHECK: bar<bool>(false);
+  foo<int>(0);      // CHECK: bar<int>(0);
+  return 0;
+}
+
+// RUN: clang-rename -offset=24 -new-name=bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=104 -new-name=bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/TemplateClassInstantiation.cpp
===================================================================
--- test/clang-rename/TemplateClassInstantiation.cpp
+++ test/clang-rename/TemplateClassInstantiation.cpp
@@ -31,14 +31,6 @@
   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
+// RUN: clang-rename -offset=29 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=311 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=445 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/StaticCastExpr.cpp
===================================================================
--- test/clang-rename/StaticCastExpr.cpp
+++ test/clang-rename/StaticCastExpr.cpp
@@ -1,7 +1,3 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=152 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
 class Baz {
 };
 
@@ -13,13 +9,13 @@
 };
 
 int main() {
-  Foo foo;                                        // FIXME: Bar foo;
+  Foo foo;                                        // CHECK: Bar foo;
   const Baz &Reference = foo;
   const Baz *Pointer = &foo;
-
   static_cast<const Foo &>(Reference).getValue(); // CHECK: static_cast<const Bar &>(Reference).getValue();
   static_cast<const Foo *>(Pointer)->getValue();  // CHECK: static_cast<const Bar *>(Pointer)->getValue();
 }
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=22 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=317 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=425 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ReinterpretCastExpr.cpp
===================================================================
--- test/clang-rename/ReinterpretCastExpr.cpp
+++ test/clang-rename/ReinterpretCastExpr.cpp
@@ -1,17 +1,15 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Cla {
+class Foo {
 public:
   int getValue() const {
     return 0;
   }
 };
 
 int main() {
-  void *C = new Cla();
-  reinterpret_cast<const Cla *>(C)->getValue(); // CHECK: reinterpret_cast<const X *>
+  void *Pointer = new Foo();
+  reinterpret_cast<const Foo *>(Pointer)->getValue(); // CHECK: reinterpret_cast<const Bar *>
 }
 
-// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=102 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=134 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/NoNewName.cpp
===================================================================
--- 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: for the -new-name option: must be specified
Index: test/clang-rename/Namespace.cpp
===================================================================
--- test/clang-rename/Namespace.cpp
+++ test/clang-rename/Namespace.cpp
@@ -1,14 +1,9 @@
-// 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 { // CHECK: namespace clang {
   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.
+// RUN: clang-rename -offset=10 -new-name=clang %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/MemberExprMacro.cpp
===================================================================
--- test/clang-rename/MemberExprMacro.cpp
+++ test/clang-rename/MemberExprMacro.cpp
@@ -1,7 +1,3 @@
-// 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;
@@ -17,5 +13,5 @@
   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.
+// RUN: clang-rename -offset=26 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=147 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/FunctionWithClassFindByName.cpp
===================================================================
--- test/clang-rename/FunctionWithClassFindByName.cpp
+++ test/clang-rename/FunctionWithClassFindByName.cpp
@@ -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 @@
   return 0;
 }
 
+// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/FunctionOverride.cpp
===================================================================
--- test/clang-rename/FunctionOverride.cpp
+++ test/clang-rename/FunctionOverride.cpp
@@ -1,10 +1,7 @@
-// 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(); };    // 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(); };
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of Foo when changing
-// this file.
+// RUN: clang-rename -offset=23 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=105 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=187 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/FunctionMacro.cpp
===================================================================
--- test/clang-rename/FunctionMacro.cpp
+++ test/clang-rename/FunctionMacro.cpp
@@ -1,7 +1,3 @@
-// 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
 
 int foo() {     // CHECK: int macro_function() {
@@ -17,5 +13,4 @@
   boo(moo());
 }
 
-// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=58 -new-name=macro_function %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/Field.cpp
===================================================================
--- test/clang-rename/Field.cpp
+++ test/clang-rename/Field.cpp
@@ -1,14 +1,10 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=148 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
 class Baz {
   int Foo;              // CHECK: Bar;
 public:
   Baz();
 };
 
 Baz::Baz() : Foo(0) {}  // CHECK: Baz::Baz() : Bar(0) {}
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=85 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/DynamicCastExpr.cpp
===================================================================
--- test/clang-rename/DynamicCastExpr.cpp
+++ test/clang-rename/DynamicCastExpr.cpp
@@ -1,7 +1,3 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=195 -new-name=Bar %t.cpp -i -- -frtti
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
 class Baz {
   virtual int getValue() const = 0;
 };
@@ -14,13 +10,13 @@
 };
 
 int main() {
-  Foo foo;                                         // FIXME: Bar foo; <- this one fails
+  Foo foo;                                         // FIXME: Bar foo;
   const Baz &Reference = foo;
   const Baz *Pointer = &foo;
 
   dynamic_cast<const Foo &>(Reference).getValue(); // CHECK: dynamic_cast<const Bar &>(Reference).getValue();
   dynamic_cast<const Foo *>(Pointer)->getValue();  // CHECK: dynamic_cast<const Bar *>(Pointer)->getValue();
 }
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=58 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=208 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/DtorDefinition.cpp
===================================================================
--- test/clang-rename/DtorDefinition.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=219 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo {     // CHECK: class Bar {
-public:
-  ~Foo();       // CHECK: ~Bar();
-};
-
-Foo::~Foo() {}  // CHECK: Bar::~Bar()
-
-
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
Index: test/clang-rename/DtorDeclaration.cpp
===================================================================
--- test/clang-rename/DtorDeclaration.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=175 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo { // CHECK: class Bar {
-public:
-  ~Foo();   // CHECK: ~Bar();
-};
-
-Foo::~Foo() { // CHECK: Bar::~Bar()
-}
-
-// Use grep -FUbo 'Bar' <file> to get the correct offset of foo when changing
-// this file.
Index: test/clang-rename/Dtor.cpp
===================================================================
--- /dev/null
+++ test/clang-rename/Dtor.cpp
@@ -0,0 +1,10 @@
+class Foo { // CHECK: class Bar {
+public:
+  ~Foo();   // CHECK: ~Bar();
+};
+
+Foo::~Foo() { // CHECK: Bar::~Bar()
+}
+
+// RUN: clang-rename -offset=45 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=82 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/DeclRefExpr.cpp
===================================================================
--- test/clang-rename/DeclRefExpr.cpp
+++ test/clang-rename/DeclRefExpr.cpp
@@ -1,20 +1,16 @@
-// 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;   // CHECK: static int Bar;
 };
 
 int foo(int x) { return 0; }
 #define MACRO(a) foo(a)
 
 int main() {
-  C::Foo = 1;     // CHECK: C::Bar
+  C::Foo = 1;       // CHECK: C::Bar
   MACRO(C::Foo);    // CHECK: C::Bar
-  int y = C::Foo; // CHECK: C::Bar
+  int y = C::Foo;   // CHECK: C::Bar
 }
 
-// Use grep -FUbo 'X' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=31 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=140 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/CtorInitializer.cpp
===================================================================
--- test/clang-rename/CtorInitializer.cpp
+++ test/clang-rename/CtorInitializer.cpp
@@ -1,7 +1,3 @@
-// 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 {
@@ -12,5 +8,4 @@
 
 Qux::Qux() : Foo() {} // CHECK: Qux::Qux() : Bar() {}
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=33 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/CtorFindByDefinition.cpp
===================================================================
--- test/clang-rename/CtorFindByDefinition.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=212 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo {   // CHECK: class Bar
-public:
-  Foo();      // CHECK: Bar();
-};
-
-Foo::Foo() {} // CHECK: Bar::Bar()
-
-// Use grep -FUbo 'C' <file> to get the correct offset of foo when changing
-// this file.
Index: test/clang-rename/CtorFindByDeclaration.cpp
===================================================================
--- test/clang-rename/CtorFindByDeclaration.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=174 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo {   // CHECK: class Bar
-public:
-  Foo();      // CHECK: Bar();
-};
-
-Foo::Foo() {} // CHECK: Bar::Bar()
-
-// Use grep -FUbo 'C' <file> to get the correct offset of foo when changing
-// this file.
Index: test/clang-rename/Ctor.cpp
===================================================================
--- /dev/null
+++ test/clang-rename/Ctor.cpp
@@ -0,0 +1,9 @@
+class Foo {   // CHECK: class Bar {
+public:
+  Foo();      // CHECK: Bar();
+};
+
+Foo::Foo() {} // CHECK: Bar::Bar() {}
+
+// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=84 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ConstructExpr.cpp
===================================================================
--- test/clang-rename/ConstructExpr.cpp
+++ test/clang-rename/ConstructExpr.cpp
@@ -1,12 +1,7 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=136 -new-name=Boo %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo {};         // CHECK: class Boo {};
+class Foo {};         // CHECK: class Bar {};
 
 int main() {
-  Foo *C = new Foo(); // CHECK: Boo *C = new Boo();
+  Foo *C = new Foo(); // CHECK: Bar *C = new Bar();
 }
 
-// Use grep -FUbo 'Boo' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ConstCastExpr.cpp
===================================================================
--- test/clang-rename/ConstCastExpr.cpp
+++ test/clang-rename/ConstCastExpr.cpp
@@ -1,7 +1,3 @@
-// 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 {                         // CHECK: class Bar {
 public:
   int getValue() {
@@ -14,5 +10,4 @@
   const_cast<Foo *>(C)->getValue(); // CHECK: const_cast<Bar *>(C)->getValue();
 }
 
-// Use grep -FUbo 'Cla' <file> to get the correct offset of foo when changing
-// this file.
+// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ComplicatedClassType.cpp
===================================================================
--- test/clang-rename/ComplicatedClassType.cpp
+++ test/clang-rename/ComplicatedClassType.cpp
@@ -1,7 +1,3 @@
-// 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;
 
@@ -29,3 +25,6 @@
   }
   return 0;
 }
+
+// RUN: clang-rename -offset=30 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=90 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ComplexFunctionOverride.cpp
===================================================================
--- test/clang-rename/ComplexFunctionOverride.cpp
+++ test/clang-rename/ComplexFunctionOverride.cpp
@@ -1,7 +1,3 @@
-// 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();
 };
@@ -21,3 +17,9 @@
 struct E : D {
   void foo() override;  // CHECK: void bar() override;
 };
+
+// RUN: clang-rename -offset=26 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=91 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=165 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=239 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=313 -new-name=bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ClassTestMultiByName.cpp
===================================================================
--- test/clang-rename/ClassTestMultiByName.cpp
+++ test/clang-rename/ClassTestMultiByName.cpp
@@ -1,8 +1,7 @@
-// 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
 };
+
+// RUN: clang-rename rename-all -old-name=Foo1 -new-name=Bar1 -old-name=Foo2 -new-name=Bar2 %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ClassTestMulti.cpp
===================================================================
--- test/clang-rename/ClassTestMulti.cpp
+++ test/clang-rename/ClassTestMulti.cpp
@@ -1,8 +1,7 @@
-// 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 Foo2 { // CHECK: class Bar2
 };
+
+// RUN: clang-rename rename-all -offset=6 -new-name=Bar1 -offset=44 -new-name=Bar2 %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ClassSimpleRenaming.cpp
===================================================================
--- test/clang-rename/ClassSimpleRenaming.cpp
+++ test/clang-rename/ClassSimpleRenaming.cpp
@@ -1,13 +1,10 @@
-// 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 {};       // CHECK: class Bar
 
 int main() {
   Foo *Pointer = 0; // CHECK: Bar *Pointer = 0;
   return 0;
 }
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing
+// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// Use grep -Ubo 'Foo' <file> to get the correct offset of Cla when changing
 // this file.
Index: test/clang-rename/ClassNameInFunctionDefinition.cpp
===================================================================
--- test/clang-rename/ClassNameInFunctionDefinition.cpp
+++ test/clang-rename/ClassNameInFunctionDefinition.cpp
@@ -1,10 +1,8 @@
-// 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 {             // CHECK: class Bar {
 public:
   void foo(int x);
 };
 
 void Foo::foo(int x) {} // CHECK: void Bar::foo(int x) {}
+
+// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ClassFindByName.cpp
===================================================================
--- test/clang-rename/ClassFindByName.cpp
+++ test/clang-rename/ClassFindByName.cpp
@@ -1,11 +1,9 @@
-// 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;
 }
+
+// RUN: clang-rename rename-all -old-name=Foo -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
Index: test/clang-rename/ClassAsTemplateArgumentFindByTemplateArgument.cpp
===================================================================
--- test/clang-rename/ClassAsTemplateArgumentFindByTemplateArgument.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=304 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-
-class Foo {};   // CHECK: class Bar {};
-
-template <typename T>
-void func() {}
-
-template <typename T>
-class Baz {};
-
-int main() {
-  func<Foo>();  // CHECK: func<Bar>();
-  Baz<Foo> obj; // CHECK: Baz<Bar> obj;
-  return 0;
-}
-
-// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing
-// this file.
Index: test/clang-rename/ClassAsTemplateArgument.cpp
===================================================================
--- test/clang-rename/ClassAsTemplateArgument.cpp
+++ test/clang-rename/ClassAsTemplateArgument.cpp
@@ -1,7 +1,3 @@
-// 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 {};   // CHECK: class Bar {};
 
 template <typename T>
@@ -16,5 +12,5 @@
   return 0;
 }
 
-// Use grep -FUbo 'Foo' <file> to get the correct offset of Foo when changing
-// this file.
+// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
+// RUN: clang-rename -offset=175 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to