-
Notifications
You must be signed in to change notification settings - Fork 64
/
CodeRefactor_Class.cpp
44 lines (33 loc) · 1.07 KB
/
CodeRefactor_Class.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// RUN: clang -cc1 -load %shlibdir/libCodeRefactor%shlibext -plugin CodeRefactor -plugin-arg-CodeRefactor -class-name \
// RUN: -plugin-arg-CodeRefactor Base -plugin-arg-CodeRefactor -old-name -plugin-arg-CodeRefactor run \
// RUN: -plugin-arg-CodeRefactor -new-name -plugin-arg-CodeRefactor walk %s 2>&1 | FileCheck %s --match-full-lines
// RUN: ../bin/ct-code-refactor --class-name=Base --new-name=walk --old-name=run %s -- | FileCheck %s --match-full-lines
// Verify that the method `run` is renamed as `walk` (in both Base and Derived)
// CHECK-LABEL: class Base {
// CHECK: virtual void walk() {};
// CHECK-LABEL: class Derived : public Base {
// CHECK: void walk() override {};
// CHECK-LABEL: int main() {
// CHECK: B1.walk();
// CHECK: D1.walk();
// CHECK: B2->walk();
// CHECK: D2->walk();
class Base {
public:
virtual void run() {};
};
class Derived : public Base {
public:
void run() override {};
};
int main() {
Base B1;
Derived D1;
B1.run();
D1.run();
Base *B2 = new Base();
Derived *D2 = new Derived();
B2->run();
D2->run();
return 0;
}