annotate projects/compiler-rt/test/cfi/simple-pass.cpp @ 181:df311c476dd5

CreateIdentifierInfo in ParseCbC (not yet worked)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 31 May 2020 12:30:11 +0900
parents f476a9ba4795
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
131
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
1 // RUN: %clangxx_cfi -o %t %s
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
2 // RUN: %run %t
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
3
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
4 // Tests that the CFI mechanism does not crash the program when making various
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
5 // kinds of valid calls involving classes with various different linkages and
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
6 // types of inheritance, and both virtual and non-virtual member functions.
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
7
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
8 #include "utils.h"
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
9
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
10 struct A {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
11 virtual void f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
12 void g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
13 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
14
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
15 void A::f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
16 void A::g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
17
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
18 struct A2 : A {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
19 virtual void f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
20 void g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
21 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
22
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
23 void A2::f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
24 void A2::g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
25
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
26 struct B {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
27 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
28 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
29 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
30
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
31 struct B2 : B {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
32 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
33 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
34 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
35
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
36 namespace {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
37
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
38 struct C {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
39 virtual void f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
40 void g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
41 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
42
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
43 void C::f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
44 void C::g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
45
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
46 struct C2 : C {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
47 virtual void f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
48 void g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
49 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
50
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
51 void C2::f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
52 void C2::g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
53
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
54 struct D {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
55 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
56 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
57 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
58
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
59 struct D2 : D {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
60 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
61 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
62 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
63
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
64 }
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
65
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
66 struct E {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
67 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
68 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
69 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
70
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
71 struct E2 : virtual E {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
72 virtual void f() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
73 void g() {}
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
74 };
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
75
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
76 int main() {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
77 A *a = new A;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
78 break_optimization(a);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
79 a->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
80 a->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
81 a = new A2;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
82 break_optimization(a);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
83 a->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
84 a->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
85
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
86 B *b = new B;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
87 break_optimization(b);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
88 b->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
89 b->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
90 b = new B2;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
91 break_optimization(b);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
92 b->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
93 b->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
94
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
95 C *c = new C;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
96 break_optimization(c);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
97 c->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
98 c->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
99 c = new C2;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
100 break_optimization(c);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
101 c->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
102 c->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
103
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
104 D *d = new D;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
105 break_optimization(d);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
106 d->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
107 d->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
108 d = new D2;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
109 break_optimization(d);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
110 d->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
111 d->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
112
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
113 E *e = new E;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
114 break_optimization(e);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
115 e->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
116 e->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
117 e = new E2;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
118 break_optimization(e);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
119 e->f();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
120 e->g();
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
121 }