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