Clang Project

clang_source_code/test/clang-rename/UserDefinedConversion.cpp
1class Foo {       /* Test 1 */          // CHECK: class Bar {
2public:
3  Foo() {}                              // CHECK: Bar() {}
4};
5
6class Baz {
7public:
8  operator Foo()  /* Test 2 */ const {  // CHECK: operator Bar()  /* Test 2 */ const {
9    Foo foo;                            // CHECK: Bar foo;
10    return foo;
11  }
12};
13
14int main() {
15  Baz boo;
16  Foo foo = static_cast<Foo>(boo);      // CHECK: Bar foo = static_cast<Bar>(boo);
17  return 0;
18}
19
20// Test 1.
21// RUN: clang-rename -offset=7 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
22// Test 2.
23// RUN: clang-rename -offset=164 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
24
25// To find offsets after modifying the file, use:
26//   grep -Ubo 'Foo.*' <file>
27