1 // Forward declaration.
2 class Foo
; /* Test 1 */ // CHECK: class Bar; /* Test 1 */
5 virtual int getValue() const = 0;
8 class Foo
: public Baz
{ /* Test 2 */// CHECK
: class Bar
: public Baz
{
10 Foo(int value
= 0) : x(value
) {} // CHECK: Bar(int value = 0) : x(value) {}
12 Foo
&operator++(int) { // CHECK: Bar &operator++(int) {
17 bool operator<(Foo
const &rhs
) { // CHECK: bool operator<(Bar const &rhs) {
18 return this->x
< rhs
.x
;
21 int getValue() const {
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();
48 // RUN: clang-rename -offset=30 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
50 // RUN: clang-rename -offset=155 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
52 // RUN: clang-rename -offset=1133 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
54 // RUN: clang-rename -offset=1266 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
56 // RUN: clang-rename -offset=1402 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
58 // RUN: clang-rename -offset=1533 -new-name=Bar %s -- -frtti | sed 's,//.*,,' | FileCheck %s
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>