xref: /llvm-project/clang/test/Templight/templight-nested-memoization.cpp (revision 207e7b1fa179c359182c25f76dfc18bb757166e5)
1*207e7b1fSGabor Horvath // RUN: %clang_cc1 -templight-dump %s 2>&1 | FileCheck %s
2*207e7b1fSGabor Horvath 
3*207e7b1fSGabor Horvath template <int N>
4*207e7b1fSGabor Horvath struct fib
5*207e7b1fSGabor Horvath {
6*207e7b1fSGabor Horvath   static const int value = fib<N-1>::value + fib<N-2>::value;
7*207e7b1fSGabor Horvath };
8*207e7b1fSGabor Horvath 
9*207e7b1fSGabor Horvath template <>
10*207e7b1fSGabor Horvath struct fib<0>
11*207e7b1fSGabor Horvath {
12*207e7b1fSGabor Horvath   static const int value = 1;
13*207e7b1fSGabor Horvath };
14*207e7b1fSGabor Horvath 
15*207e7b1fSGabor Horvath template <>
16*207e7b1fSGabor Horvath struct fib<1>
17*207e7b1fSGabor Horvath {
18*207e7b1fSGabor Horvath   static const int value = 1;
19*207e7b1fSGabor Horvath };
20*207e7b1fSGabor Horvath 
21*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
22*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<4>'$}}
23*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
24*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
25*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
26*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:173:8'$}}
27*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
28*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<4>'$}}
29*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
30*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
31*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
32*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:173:8'$}}
33*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
34*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<4>'$}}
35*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
36*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
37*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
38*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:173:8'$}}
39*207e7b1fSGabor Horvath //
40*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
41*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
42*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
43*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
44*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
45*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
46*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
47*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
48*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
49*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
50*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
51*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
52*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
53*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
54*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
55*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
56*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
57*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
58*207e7b1fSGabor Horvath //
59*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
60*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
61*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
62*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
63*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
64*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
65*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
66*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
67*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
68*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
69*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
70*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
71*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
72*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
73*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
74*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
75*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
76*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
77*207e7b1fSGabor Horvath 
78*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
79*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<1>'$}}
80*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
81*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
82*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:16:8'}}
83*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
84*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
85*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<1>'$}}
86*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
87*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
88*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:16:8'}}
89*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
90*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
91*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<0>'$}}
92*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
93*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
94*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:10:8'}}
95*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
96*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
97*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<0>'$}}
98*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
99*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
100*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:10:8'}}
101*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
102*207e7b1fSGabor Horvath //
103*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
104*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
105*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
106*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
107*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
108*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
109*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
110*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
111*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
112*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
113*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
114*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
115*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
116*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
117*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
118*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
119*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
120*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
121*207e7b1fSGabor Horvath //
122*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
123*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<1>'$}}
124*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
125*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
126*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:16:8'}}
127*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
128*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
129*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<1>'$}}
130*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
131*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
132*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:16:8'}}
133*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
134*207e7b1fSGabor Horvath //
135*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
136*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
137*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
138*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
139*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
140*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
141*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
142*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
143*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
144*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
145*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
146*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
147*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
148*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<3>'$}}
149*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
150*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
151*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
152*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:28'$}}
153*207e7b1fSGabor Horvath //
154*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
155*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
156*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
157*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+Begin$}}
158*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
159*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
160*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
161*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<2>'$}}
162*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+Memoization$}}
163*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
164*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
165*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:6:46'$}}
166*207e7b1fSGabor Horvath // CHECK-LABEL: {{^---$}}
167*207e7b1fSGabor Horvath //
168*207e7b1fSGabor Horvath // CHECK: {{^name:[ ]+'fib<4>'$}}
169*207e7b1fSGabor Horvath // CHECK: {{^kind:[ ]+TemplateInstantiation$}}
170*207e7b1fSGabor Horvath // CHECK: {{^event:[ ]+End$}}
171*207e7b1fSGabor Horvath // CHECK: {{^orig:[ ]+'.*templight-nested-memoization.cpp:4:8'}}
172*207e7b1fSGabor Horvath // CHECK: {{^poi:[ ]+'.*templight-nested-memoization.cpp:173:8'$}}
173*207e7b1fSGabor Horvath fib<4> x;
174*207e7b1fSGabor Horvath 
175