[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / clang-rename / ComplicatedClassType.cpp
blob8801953031273ae15b48f6bc6db9164322c2d749
1 // Forward declaration.
2 class Foo; /* Test 1 */ // CHECK: class Bar; /* Test 1 */
4 class Baz {
5 virtual int getValue() const = 0;
6 };
8 class Foo : public Baz { /* Test 2 */// CHECK: class Bar : public Baz {
9 public:
10 Foo(int value = 0) : x(value) {} // CHECK: Bar(int value = 0) : x(value) {}
12 Foo &operator++(int) { // CHECK: Bar &operator++(int) {
13 x++;
14 return *this;
17 bool operator<(Foo const &rhs) { // CHECK: bool operator<(Bar const &rhs) {
18 return this->x < rhs.x;
21 int getValue() const {
22 return 0;
25 private:
26 int x;
29 int main() {
30 Foo *Pointer = 0; // CHECK: Bar *Pointer = 0;
31 Foo Variable = Foo(10); // CHECK: Bar Variable = Bar(10);
32 for (Foo it; it < Variable; it++) { // CHECK: for (Bar it; it < Variable; it++) {
34 const Foo *C = new Foo(); // CHECK: const Bar *C = new Bar();
35 const_cast<Foo *>(C)->getValue(); // CHECK: const_cast<Bar *>(C)->getValue();
36 Foo foo; // CHECK: Bar foo;
37 const Baz &BazReference = foo;
38 const Baz *BazPointer = &foo;
39 dynamic_cast<const Foo &>(BazReference).getValue(); /* Test 3 */ // CHECK: dynamic_cast<const Bar &>(BazReference).getValue();
40 dynamic_cast<const Foo *>(BazPointer)->getValue(); /* Test 4 */ // CHECK: dynamic_cast<const Bar *>(BazPointer)->getValue();
41 reinterpret_cast<const Foo *>(BazPointer)->getValue(); /* Test 5 */ // CHECK: reinterpret_cast<const Bar *>(BazPointer)->getValue();
42 static_cast<const Foo &>(BazReference).getValue(); /* Test 6 */ // CHECK: static_cast<const Bar &>(BazReference).getValue();
43 static_cast<const Foo *>(BazPointer)->getValue(); /* Test 7 */ // CHECK: static_cast<const Bar *>(BazPointer)->getValue();
44 return 0;
47 // Test 1.
48 // RUN: clang-rename -offset=30 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
49 // Test 2.
50 // RUN: clang-rename -offset=155 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
51 // Test 3.
52 // RUN: clang-rename -offset=1133 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
53 // Test 4.
54 // RUN: clang-rename -offset=1266 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
55 // Test 5.
56 // RUN: clang-rename -offset=1402 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
57 // Test 6.
58 // RUN: clang-rename -offset=1533 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
59 // Test 7.
60 // RUN: clang-rename -offset=1665 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
62 // To find offsets after modifying the file, use:
63 // grep -Ubo 'Foo.*' <file>