[clang-tools-extra] r275681 - [clang-rename] remove obsolete tests and apply fixes to existing

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 16 01:55:01 PDT 2016


Author: omtcyfz
Date: Sat Jul 16 03:55:01 2016
New Revision: 275681

URL: http://llvm.org/viewvc/llvm-project?rev=275681&view=rev
Log:
[clang-rename] remove obsolete tests and apply fixes to existing

Few tests introduced by previous patch had obsolete counterparts.

Applied fixes to {Dynamic|Static}CastExpr.cpp

Added:
    clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp
Removed:
    clang-tools-extra/trunk/test/clang-rename/ClassTest.cpp
    clang-tools-extra/trunk/test/clang-rename/ClassTestByName.cpp
    clang-tools-extra/trunk/test/clang-rename/ClassTestReplacements.cpp
    clang-tools-extra/trunk/test/clang-rename/ComplicatedClassTest.cpp
    clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
    clang-tools-extra/trunk/test/clang-rename/CtorInitializerTest.cpp
    clang-tools-extra/trunk/test/clang-rename/DtorDefTest.cpp
    clang-tools-extra/trunk/test/clang-rename/FieldTest.cpp
    clang-tools-extra/trunk/test/clang-rename/VarTest.cpp
Modified:
    clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
    clang-tools-extra/trunk/test/clang-rename/StaticCastExpr.cpp

Removed: clang-tools-extra/trunk/test/clang-rename/ClassTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/ClassTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/ClassTest.cpp (removed)
@@ -1,15 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=138 -new-name=Hector %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Cla  // CHECK: class Hector
-{
-};
-
-int main()
-{
-    Cla *Pointer = 0; // CHECK: Hector *Pointer = 0;
-    return 0;
-}
-
-// Use grep -FUbo 'Cla' <file> to get the correct offset of Cla when changing
-// this file.

Removed: clang-tools-extra/trunk/test/clang-rename/ClassTestByName.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTestByName.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/ClassTestByName.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/ClassTestByName.cpp (removed)
@@ -1,10 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -old-name=Cla -new-name=Hector %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Cla { // CHECK: class Hector
-};
-
-int main() {
-  Cla *Pointer = 0; // CHECK: Hector *Pointer = 0;
-  return 0;
-}

Removed: clang-tools-extra/trunk/test/clang-rename/ClassTestReplacements.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ClassTestReplacements.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/ClassTestReplacements.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/ClassTestReplacements.cpp (removed)
@@ -1,12 +0,0 @@
-// RUN: rm -rf %t
-// RUN: mkdir -p %t/fixes
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=256 -new-name=Hector -export-fixes=%t/fixes/clang-rename.yaml %t.cpp --
-// RUN: clang-apply-replacements %t
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Cla  // CHECK: class Hector
-{
-};
-
-// Use grep -FUbo 'Cla' <file> to get the correct offset of Cla when changing
-// this file.

Removed: clang-tools-extra/trunk/test/clang-rename/ComplicatedClassTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ComplicatedClassTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/ComplicatedClassTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/ComplicatedClassTest.cpp (removed)
@@ -1,30 +0,0 @@
-// Unsupported test.
-// RUN: cat %s > %t.cpp
-// FIXME: This test contains very simple constructions likely to be seen in any
-// project and therefore passing this test is a slight sign of success.
-// Currently, the test fails badly.
-
-class Foo {                           // CHECK: class Bar {
- public:
-  Foo(int value = 0) : x(value) {}    // Bar(int value=0) : x(value) {}
-
-  Foo& operator++(int) {              // Bar& operator++(int) {
-    x++;
-    return *this;
-  }
-
-  bool operator<(Foo const& rhs) {    // bool operator<(Bar const &rhs) {
-    return this->x < rhs.x;
-  }
-
- 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++) { // for (Bar it; it < Variable; it++) {}
-  }
-  return 0;
-}

Added: 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=275681&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp (added)
+++ clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp Sat Jul 16 03:55:01 2016
@@ -0,0 +1,30 @@
+// Unsupported test.
+// RUN: cat %s > %t.cpp
+// FIXME: This test contains very simple constructions likely to be seen in any
+// project and therefore passing this test is a slight sign of success.
+// Currently, the test fails badly.
+
+class Foo {                           // CHECK: class Bar {
+ public:
+  Foo(int value = 0) : x(value) {}    // Bar(int value=0) : x(value) {}
+
+  Foo& operator++(int) {              // Bar& operator++(int) {
+    x++;
+    return *this;
+  }
+
+  bool operator<(Foo const& rhs) {    // bool operator<(Bar const &rhs) {
+    return this->x < rhs.x;
+  }
+
+ 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++) { // for (Bar it; it < Variable; it++) {}
+  }
+  return 0;
+}

Removed: clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp (removed)
@@ -1,15 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class C
-{
-public:
-    C();
-};
-
-C::C() // CHECK: D::D()
-{
-}
-
-// Use grep -FUbo 'C' <file> to get the correct offset of foo when changing
-// this file.

Removed: clang-tools-extra/trunk/test/clang-rename/CtorInitializerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/CtorInitializerTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/CtorInitializerTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/CtorInitializerTest.cpp (removed)
@@ -1,20 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=162 -new-name=hector %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class A
-{
-};
-
-class Cla
-{
-  A foo; // CHECK: hector;
-public:
-  Cla();
-};
-
-Cla::Cla() // CHECK: Cla::Cla()
-{
-}
-
-// Use grep -FUbo 'foo' <file> to get the correct offset of foo when changing
-// this file.

Removed: clang-tools-extra/trunk/test/clang-rename/DtorDefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DtorDefTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/DtorDefTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/DtorDefTest.cpp (removed)
@@ -1,17 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=135 -new-name=Bar %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Foo {
-public:
-  Foo();
-  ~Foo(); // CHECK: ~Bar();
-};
-
-Foo::Foo() {
-}
-
-Foo::~Foo() { // CHECK: Bar::~Bar()
-}
-
-// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
-// this file.

Modified: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp?rev=275681&r1=275680&r2=275681&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp Sat Jul 16 03:55:01 2016
@@ -1,11 +1,12 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
+// RUN: clang-rename -offset=195 -new-name=Bar %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Base {
+
+class Baz {
   virtual int getValue() const = 0;
 };
 
-class Derived : public Base {
+class Foo : public Baz {                           // CHECK: class Bar : public Baz {
 public:
   int getValue() const {
     return 0;
@@ -13,13 +14,13 @@ public:
 };
 
 int main() {
-  Derived D;
-  const Base &Reference = D;
-  const Base *Pointer = &D;
+  Foo foo;                                         // FIXME: Bar foo; <- this one fails
+  const Baz &Reference = foo;
+  const Baz *Pointer = &foo;
 
-  dynamic_cast<const Derived &>(Reference).getValue(); // CHECK: dynamic_cast<const X &>
-  dynamic_cast<const Derived *>(Pointer)->getValue();  // CHECK: dynamic_cast<const X *>
+  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 'Derived' <file> to get the correct offset of foo when changing
+// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
 // this file.

Removed: clang-tools-extra/trunk/test/clang-rename/FieldTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/FieldTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/FieldTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/FieldTest.cpp (removed)
@@ -1,17 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=150 -new-name=hector %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Cla
-{
-  int foo; // CHECK: hector;
-public:
-  Cla();
-};
-
-Cla::Cla()
-  : foo(0) // CHECK: hector(0)
-{
-}
-
-// Use grep -FUbo 'foo' <file> to get the correct offset of foo when changing
-// this file.

Modified: clang-tools-extra/trunk/test/clang-rename/StaticCastExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/StaticCastExpr.cpp?rev=275681&r1=275680&r2=275681&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/StaticCastExpr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/StaticCastExpr.cpp Sat Jul 16 03:55:01 2016
@@ -1,10 +1,11 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=150 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=152 -new-name=Bar %t.cpp -i --
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-class Base {
+
+class Baz {
 };
 
-class Derived : public Base {
+class Foo : public Baz {                          // CHECK: class Bar : public Baz {
 public:
   int getValue() const {
     return 0;
@@ -12,13 +13,13 @@ public:
 };
 
 int main() {
-  Derived D;
-  const Base &Reference = D;
-  const Base *Pointer = &D;
+  Foo foo;                                        // FIXME: Bar foo;
+  const Baz &Reference = foo;
+  const Baz *Pointer = &foo;
 
-  static_cast<const Derived &>(Reference).getValue(); // CHECK: static_cast<const X &>
-  static_cast<const Derived *>(Pointer)->getValue();  // CHECK: static_cast<const X *>
+  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 'Derived' <file> to get the correct offset of foo when changing
+// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
 // this file.

Removed: clang-tools-extra/trunk/test/clang-rename/VarTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/VarTest.cpp?rev=275680&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/VarTest.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/VarTest.cpp (removed)
@@ -1,24 +0,0 @@
-// RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=150 -new-name=hector %t.cpp -i --
-// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
-namespace A { int foo;  // CHECK: int hector;
-}
-int foo;  // CHECK: int foo;
-int bar = foo; // CHECK: bar = foo;
-int baz = A::foo; // CHECK: baz = A::hector;
-void fun1() {
-  struct {
-    int foo; // CHECK: int foo;
-  } b = { 100 };
-  int foo = 100; // CHECK: int foo
-  baz = foo; // CHECK: baz = foo;
-  {
-    extern int foo; // CHECK: int foo;
-    baz = foo; // CHECK: baz = foo;
-    foo = A::foo + baz; // CHECK: foo = A::hector + baz;
-    A::foo = b.foo; // CHECK: A::hector = b.foo;
-  }
-  foo = b.foo; // CHECK: foo = b.foo;
-}
-// Use grep -FUbo 'foo;' <file> to get the correct offset of foo when changing
-// this file.




More information about the cfe-commits mailing list