Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-15 Thread Kirill Bobyrev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL275545: [clang-rename] add few tests (authored by omtcyfz).

Changed prior to commit:
  https://reviews.llvm.org/D22102?vs=63939=64119#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22102

Files:
  clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp
  clang-tools-extra/trunk/test/clang-rename/Namespace.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/VariableMacro.cpp

Index: clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp
+++ clang-tools-extra/trunk/test/clang-rename/TemplateTypename.cpp
@@ -0,0 +1,11 @@
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename template parameters correctly.
+
+template 
+T foo(T arg, T& ref, T* ptr) {
+  T value;
+  int number = 42;
+  value = (T)number;
+  value = static_cast(number);
+  return value;
+}
Index: clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp
+++ clang-tools-extra/trunk/test/clang-rename/FunctionMacro.cpp
@@ -0,0 +1,21 @@
+// 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() {
+  return 42;
+}
+
+void boo(int value) {}
+
+void qoo() {
+  foo();// CHECK: macro_function();
+  boo(foo());   // CHECK: boo(macro_function());
+  moo();
+  boo(moo());
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp
+++ clang-tools-extra/trunk/test/clang-rename/VariableMacro.cpp
@@ -0,0 +1,18 @@
+// 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
+
+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);
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp
+++ clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp
@@ -0,0 +1,12 @@
+// Currently unsupported test.
+// FIXME: clang-rename should handle conversions from a class type to another
+// type.
+
+class Foo {}; // CHECK: class Bar {};
+
+class Baz {   // CHECK: class Bar {
+  operator Foo() const {  // CHECK: operator Bar() const {
+Foo foo;  // CHECK: Bar foo;
+return foo;
+  }
+};
Index: clang-tools-extra/trunk/test/clang-rename/Namespace.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/Namespace.cpp
+++ clang-tools-extra/trunk/test/clang-rename/Namespace.cpp
@@ -0,0 +1,14 @@
+// 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 {
+  int x;
+}
+
+void boo() {
+  foo::x = 42;  // CHECK: llvm::x = 42;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Kirill Bobyrev via cfe-commits
omtcyf0 added a comment.

@vmiklos sure thing.

Thanks for noticing!


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 63939.

http://reviews.llvm.org/D22102

Files:
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/Namespace.cpp
  test/clang-rename/TemplateTypename.cpp
  test/clang-rename/UserDefinedConversion.cpp
  test/clang-rename/VariableMacro.cpp

Index: test/clang-rename/VariableMacro.cpp
===
--- /dev/null
+++ test/clang-rename/VariableMacro.cpp
@@ -0,0 +1,18 @@
+// 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
+
+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);
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/UserDefinedConversion.cpp
===
--- /dev/null
+++ test/clang-rename/UserDefinedConversion.cpp
@@ -0,0 +1,12 @@
+// Currently unsupported test.
+// FIXME: clang-rename should handle conversions from a class type to another
+// type.
+
+class Foo {};
+
+class Boo {
+  operator Foo() const {
+Foo foo;
+return foo;
+  }
+};
Index: test/clang-rename/TemplateTypename.cpp
===
--- /dev/null
+++ test/clang-rename/TemplateTypename.cpp
@@ -0,0 +1,11 @@
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename template parameters correctly.
+
+template 
+T foo(T arg, T& ref, T* ptr) {
+  T value;
+  int number = 42;
+  value = (T)number;
+  value = static_cast(number);
+  return value;
+}
Index: test/clang-rename/Namespace.cpp
===
--- /dev/null
+++ test/clang-rename/Namespace.cpp
@@ -0,0 +1,14 @@
+// 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 {
+  int x;
+}
+
+void boo() {
+  foo::x = 42;  // CHECK: llvm::x = 42;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/FunctionMacro.cpp
===
--- /dev/null
+++ test/clang-rename/FunctionMacro.cpp
@@ -0,0 +1,21 @@
+// 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() {
+  return 42;
+}
+
+void boo(int value) {}
+
+void qoo() {
+  foo();// CHECK: macro_function();
+  boo(foo());   // CHECK: boo(macro_function());
+  moo();
+  boo(moo());
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Miklos Vajna via cfe-commits
vmiklos added a subscriber: vmiklos.
vmiklos added a comment.

Can you please avoid adding VirtualFunction.cpp? http://reviews.llvm.org/D22237 
would add it as well, but without the FIXME. Thanks! :-)


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Kirill Bobyrev via cfe-commits
omtcyf0 added a comment.

Thanks, Manuel!

Can you please land it?


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Kirill Bobyrev via cfe-commits
omtcyf0 marked an inline comment as done.
omtcyf0 added a comment.

Oops, sorry. Fixed it.

+1 currently unsupported test.


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 63934.

http://reviews.llvm.org/D22102

Files:
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/Namespace.cpp
  test/clang-rename/TemplateTypename.cpp
  test/clang-rename/UserDefinedConversion.cpp
  test/clang-rename/VariableMacro.cpp
  test/clang-rename/VirtualFunction.cpp

Index: test/clang-rename/VirtualFunction.cpp
===
--- /dev/null
+++ test/clang-rename/VirtualFunction.cpp
@@ -0,0 +1,13 @@
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename virtual function and all the
+// functions which override it.
+
+class A {
+public:
+  virtual void foo();
+};
+
+class B : public A {
+public:
+  void foo();
+};
Index: test/clang-rename/VariableMacro.cpp
===
--- /dev/null
+++ test/clang-rename/VariableMacro.cpp
@@ -0,0 +1,18 @@
+// 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
+
+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);
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/UserDefinedConversion.cpp
===
--- /dev/null
+++ test/clang-rename/UserDefinedConversion.cpp
@@ -0,0 +1,12 @@
+// Currently unsupported test.
+// FIXME: clang-rename should handle conversions from a class type to another
+// type.
+
+class Foo {};
+
+class Boo {
+  operator Foo() const {
+Foo foo;
+return foo;
+  }
+};
Index: test/clang-rename/TemplateTypename.cpp
===
--- /dev/null
+++ test/clang-rename/TemplateTypename.cpp
@@ -0,0 +1,11 @@
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename template parameters correctly.
+
+template 
+T foo(T arg, T& ref, T* ptr) {
+  T value;
+  int number = 42;
+  value = (T)number;
+  value = static_cast(number);
+  return value;
+}
Index: test/clang-rename/Namespace.cpp
===
--- /dev/null
+++ test/clang-rename/Namespace.cpp
@@ -0,0 +1,14 @@
+// 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 {
+  int x;
+}
+
+void boo() {
+  foo::x = 42;  // CHECK: llvm::x = 42;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/FunctionMacro.cpp
===
--- /dev/null
+++ test/clang-rename/FunctionMacro.cpp
@@ -0,0 +1,21 @@
+// 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() {
+  return 42;
+}
+
+void boo(int value) {}
+
+void qoo() {
+  foo();// CHECK: macro_function();
+  boo(foo());   // CHECK: boo(macro_function());
+  moo();
+  boo(moo());
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-14 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: test/clang-rename/TemplateTypename.cpp:4
@@ +3,3 @@
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+// XFAIL: *
+

Here, too?


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-12 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 63647.

http://reviews.llvm.org/D22102

Files:
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/Namespace.cpp
  test/clang-rename/TemplateTypename.cpp
  test/clang-rename/VariableMacro.cpp
  test/clang-rename/VirtualFunction.cpp

Index: test/clang-rename/VirtualFunction.cpp
===
--- /dev/null
+++ test/clang-rename/VirtualFunction.cpp
@@ -0,0 +1,13 @@
+// Currently unsupported test.
+// FIXME: after passing A::foo() to clang-rename the tools should also rename
+// B:foo(), which overrides A::foo().
+
+class A {
+public:
+  virtual void foo();
+};
+
+class B : public A {
+public:
+  void foo();
+};
Index: test/clang-rename/VariableMacro.cpp
===
--- /dev/null
+++ test/clang-rename/VariableMacro.cpp
@@ -0,0 +1,18 @@
+// 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
+
+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);
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/TemplateTypename.cpp
===
--- /dev/null
+++ test/clang-rename/TemplateTypename.cpp
@@ -0,0 +1,16 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=152 -new-name=U %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+// XFAIL: *
+
+template  // CHECK: template 
+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(number); // CHECK: value = static_cast(number);
+  return value;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/Namespace.cpp
===
--- /dev/null
+++ test/clang-rename/Namespace.cpp
@@ -0,0 +1,14 @@
+// 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 {
+  int x;
+}
+
+void boo() {
+  foo::x = 42;  // CHECK: llvm::x = 42;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/FunctionMacro.cpp
===
--- /dev/null
+++ test/clang-rename/FunctionMacro.cpp
@@ -0,0 +1,21 @@
+// 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() {
+  return 42;
+}
+
+void boo(int value) {}
+
+void qoo() {
+  foo();// CHECK: macro_function();
+  boo(foo());   // CHECK: boo(macro_function());
+  moo();
+  boo(moo());
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-11 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Add
// FIXME: 
to tests that do not work yet.

I'd personally not check in the XFAIL tests for now, and just add them when you 
implement the missing functionality; the problem with XFAIL here is that (due 
to the offsets involved) they can easily switch into a mode where they fail not 
because the feature is not implemented, but because the test is incorrect.


http://reviews.llvm.org/D22102



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22102: [clang-rename] extend testset

2016-07-11 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 63470.
omtcyf0 added a comment.

add XFAIL test with virtual function renaming


http://reviews.llvm.org/D22102

Files:
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/Namespace.cpp
  test/clang-rename/TemplateTypename.cpp
  test/clang-rename/VariableMacro.cpp
  test/clang-rename/VirtualFunction.cpp

Index: test/clang-rename/VirtualFunction.cpp
===
--- /dev/null
+++ test/clang-rename/VirtualFunction.cpp
@@ -0,0 +1,17 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=175 -new-name=boo %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+// XFAIL: *
+
+class A {
+public:
+  virtual void foo(); // CHECK: virtual void boo();
+};
+
+class B : public A {
+public:
+  void foo(); // CHECK: void boo();
+};
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/VariableMacro.cpp
===
--- /dev/null
+++ test/clang-rename/VariableMacro.cpp
@@ -0,0 +1,18 @@
+// 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
+
+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);
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/TemplateTypename.cpp
===
--- /dev/null
+++ test/clang-rename/TemplateTypename.cpp
@@ -0,0 +1,16 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=152 -new-name=U %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+// XFAIL: *
+
+template  // CHECK: template 
+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(number); // CHECK: value = static_cast(number);
+  return value;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/Namespace.cpp
===
--- /dev/null
+++ test/clang-rename/Namespace.cpp
@@ -0,0 +1,14 @@
+// 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 {
+  int x;
+}
+
+void boo() {
+  foo::x = 42;  // CHECK: llvm::x = 42;
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/FunctionMacro.cpp
===
--- /dev/null
+++ test/clang-rename/FunctionMacro.cpp
@@ -0,0 +1,21 @@
+// 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() {
+  return 42;
+}
+
+void boo(int value) {}
+
+void qoo() {
+  foo();// CHECK: macro_function();
+  boo(foo());   // CHECK: boo(macro_function());
+  moo();
+  boo(moo());
+}
+
+// Use grep -FUbo 'foo;'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits