blob: e9ae2681a07ad8d7a46e7f2156c833599f89e78b [file] [log] [blame]
Ben Olmsteadc0d77842019-07-31 17:34:05 -07001# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Emboss C++ code generator.
16
Ted Pudlik4a044db2024-04-10 15:56:42 -070017load("@rules_python//python:py_binary.bzl", "py_binary")
18load("@rules_python//python:py_library.bzl", "py_library")
19load("@rules_python//python:py_test.bzl", "py_test")
Ben Olmsteadc0d77842019-07-31 17:34:05 -070020load(":build_defs.bzl", "emboss_cc_test")
21
22package(
Ben Olmstead5b019b52019-09-05 17:13:45 -070023 default_visibility = [
24 "//visibility:private",
25 ],
Ben Olmsteadc0d77842019-07-31 17:34:05 -070026 features = ["-layering_check"],
27)
28
29py_binary(
30 name = "emboss_codegen_cpp",
31 srcs = ["emboss_codegen_cpp.py"],
32 python_version = "PY3",
33 visibility = ["//visibility:public"],
34 deps = [
35 ":header_generator",
reventlov6731fc42019-10-03 15:23:13 -070036 "//compiler/util:ir_pb2",
Ben Olmsteadc0d77842019-07-31 17:34:05 -070037 ],
38)
39
40py_library(
Jason Graffius699bf1a2023-06-28 20:15:15 -040041 name = "attributes",
42 srcs = ["attributes.py"],
Ted Pudlik4a044db2024-04-10 15:56:42 -070043 deps = [],
Jason Graffius699bf1a2023-06-28 20:15:15 -040044)
45
46py_library(
Ben Olmsteadc0d77842019-07-31 17:34:05 -070047 name = "header_generator",
48 srcs = ["header_generator.py"],
49 data = [
50 "generated_code_templates",
51 ],
52 deps = [
Jason Graffius699bf1a2023-06-28 20:15:15 -040053 ":attributes",
reventlov6731fc42019-10-03 15:23:13 -070054 "//compiler/back_end/util:code_template",
Dmitri Prime5b381262023-05-01 23:55:07 -070055 "//compiler/util:attribute_util",
reventlov6731fc42019-10-03 15:23:13 -070056 "//compiler/util:ir_pb2",
57 "//compiler/util:ir_util",
58 "//compiler/util:name_conversion",
Ben Olmsteadb9b93c32024-02-20 21:47:41 +000059 "//compiler/util:resources",
Ben Olmsteadc0d77842019-07-31 17:34:05 -070060 ],
61)
62
Dmitri Prime5b381262023-05-01 23:55:07 -070063py_test(
64 name = "header_generator_test",
65 srcs = ["header_generator_test.py"],
66 deps = [
67 ":header_generator",
68 "//compiler/front_end:glue",
Jason Graffius91910772023-05-18 12:43:52 -040069 "//compiler/util:test_util",
Dmitri Prime5b381262023-05-01 23:55:07 -070070 ],
71)
72
Ben Olmsteadc0d77842019-07-31 17:34:05 -070073emboss_cc_test(
74 name = "span_se_log_file_status_emb_generated_code_test",
75 srcs = [
76 "testcode/read_log_file_status_test.cc",
77 ],
78 deps = [
79 "//testdata:span_se_log_file_status_emboss",
80 "@com_google_googletest//:gtest_main",
81 ],
82)
83
84emboss_cc_test(
85 name = "nested_structure_test",
86 srcs = [
87 "testcode/nested_structure_test.cc",
88 ],
89 deps = [
90 "//testdata:nested_structure_emboss",
91 "@com_google_googletest//:gtest_main",
92 ],
93)
94
95emboss_cc_test(
96 name = "alignments_test",
97 srcs = [
98 "testcode/alignments_test.cc",
99 ],
100 deps = [
101 "//testdata:alignments_emboss",
102 "@com_google_googletest//:gtest_main",
103 ],
104)
105
106emboss_cc_test(
107 name = "condition_test",
108 srcs = [
109 "testcode/condition_test.cc",
110 ],
111 deps = [
112 "//testdata:condition_emboss",
113 "@com_google_googletest//:gtest_main",
114 ],
115)
116
117emboss_cc_test(
118 name = "enum_test",
119 srcs = [
120 "testcode/enum_test.cc",
121 ],
122 deps = [
123 "//testdata:enum_emboss",
124 "@com_google_googletest//:gtest_main",
125 ],
126)
127
128emboss_cc_test(
Jason Graffius699bf1a2023-06-28 20:15:15 -0400129 name = "enum_case_test",
130 srcs = [
131 "testcode/enum_case_test.cc",
132 ],
133 deps = [
134 "//testdata:enum_case_emboss",
135 "@com_google_googletest//:gtest_main",
136 ],
137)
138
139emboss_cc_test(
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700140 name = "explicit_sizes_test",
141 srcs = [
142 "testcode/explicit_sizes_test.cc",
143 ],
144 deps = [
145 "//testdata:explicit_sizes_emboss",
146 "@com_google_googletest//:gtest_main",
147 ],
148)
149
150emboss_cc_test(
151 name = "importer_test",
152 srcs = [
153 "testcode/importer_test.cc",
154 ],
155 deps = [
156 "//testdata:importer_emboss",
157 "@com_google_googletest//:gtest_main",
158 ],
159)
160
161emboss_cc_test(
Ben Olmstead378cd5d2023-03-21 00:38:33 +0000162 name = "importer2_test",
163 srcs = [
164 "testcode/importer2_test.cc",
165 ],
166 deps = [
167 "//testdata:importer2_emboss",
168 "@com_google_googletest//:gtest_main",
169 ],
170)
171
172emboss_cc_test(
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700173 name = "uint_sizes_test",
174 srcs = [
175 "testcode/uint_sizes_test.cc",
176 ],
177 deps = [
178 "//testdata:uint_sizes_emboss",
179 "@com_google_googletest//:gtest_main",
180 ],
181)
182
183emboss_cc_test(
184 name = "int_sizes_test",
185 srcs = [
186 "testcode/int_sizes_test.cc",
187 ],
188 deps = [
189 "//testdata:int_sizes_emboss",
190 "@com_google_googletest//:gtest_main",
191 ],
192)
193
194emboss_cc_test(
195 name = "float_test",
196 srcs = [
197 "testcode/float_test.cc",
198 ],
199 deps = [
200 "//testdata:float_emboss",
201 "@com_google_googletest//:gtest_main",
202 ],
203)
204
205emboss_cc_test(
206 name = "dynamic_size_test",
207 srcs = [
208 "testcode/dynamic_size_test.cc",
209 ],
210 deps = [
211 "//testdata:dynamic_size_emboss",
212 "@com_google_googletest//:gtest_main",
213 ],
214)
215
216emboss_cc_test(
217 name = "auto_array_size_test",
218 srcs = [
219 "testcode/auto_array_size_test.cc",
220 ],
221 deps = [
222 "//testdata:auto_array_size_emboss",
223 "@com_google_googletest//:gtest_main",
224 ],
225)
226
227emboss_cc_test(
228 name = "start_size_range_test",
229 srcs = [
230 "testcode/start_size_range_test.cc",
231 ],
232 deps = [
233 "//testdata:start_size_range_emboss",
234 "@com_google_googletest//:gtest_main",
235 ],
236)
237
238emboss_cc_test(
239 name = "bcd_test",
240 srcs = [
241 "testcode/bcd_test.cc",
242 ],
243 deps = [
244 "//testdata:bcd_emboss",
245 "@com_google_googletest//:gtest_main",
246 ],
247)
248
249emboss_cc_test(
250 name = "namespace_test",
251 srcs = [
252 "testcode/namespace_test.cc",
253 ],
254 deps = [
255 "//testdata:absolute_cpp_namespace_emboss",
256 "//testdata:cpp_namespace_emboss",
257 "//testdata:no_cpp_namespace_emboss",
258 "@com_google_googletest//:gtest_main",
259 ],
260)
261
262emboss_cc_test(
263 name = "requires_test",
264 srcs = [
265 "testcode/requires_test.cc",
266 ],
267 deps = [
268 "//testdata:requires_emboss",
269 "@com_google_googletest//:gtest_main",
270 ],
271)
272
273emboss_cc_test(
274 name = "subtypes_test",
275 srcs = [
276 "testcode/subtypes_test.cc",
277 ],
278 deps = [
279 "//testdata:subtypes_emboss",
280 "@com_google_googletest//:gtest_main",
281 ],
282)
283
284emboss_cc_test(
285 name = "inline_type_test",
286 srcs = [
287 "testcode/inline_type_test.cc",
288 ],
289 deps = [
290 "//testdata:inline_type_emboss",
291 "@com_google_googletest//:gtest_main",
292 ],
293)
294
295emboss_cc_test(
296 name = "bits_test",
297 srcs = [
298 "testcode/bits_test.cc",
299 ],
300 deps = [
reventlov6731fc42019-10-03 15:23:13 -0700301 "//runtime/cpp:cpp_utils",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700302 "//testdata:bits_emboss",
303 "@com_google_googletest//:gtest_main",
304 ],
305)
306
307emboss_cc_test(
308 name = "anonymous_bits_test",
309 srcs = [
310 "testcode/anonymous_bits_test.cc",
311 ],
312 deps = [
reventlov6731fc42019-10-03 15:23:13 -0700313 "//runtime/cpp:cpp_utils",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700314 "//testdata:anonymous_bits_emboss",
315 "@com_google_googletest//:gtest_main",
316 ],
317)
318
319emboss_cc_test(
reventlov4000cd02022-04-05 12:15:39 -0700320 name = "next_keyword_test",
321 srcs = [
322 "testcode/next_keyword_test.cc",
323 ],
324 deps = [
325 "//testdata:next_keyword_emboss",
326 "@com_google_googletest//:gtest_main",
327 ],
328)
329
330emboss_cc_test(
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700331 name = "virtual_field_test",
332 srcs = [
333 "testcode/virtual_field_test.cc",
334 ],
335 deps = [
336 "//testdata:virtual_field_emboss",
337 "@com_google_googletest//:gtest_main",
338 ],
339)
340
341emboss_cc_test(
342 name = "text_format_test",
343 srcs = [
344 "testcode/text_format_test.cc",
345 ],
346 deps = [
347 "//testdata:text_format_emboss",
348 "@com_google_googletest//:gtest_main",
349 ],
350)
351
352emboss_cc_test(
353 name = "parameters_test",
354 srcs = [
355 "testcode/parameters_test.cc",
356 ],
357 deps = [
358 "//testdata:parameters_emboss",
359 "@com_google_googletest//:gtest_main",
360 ],
361)
362
363emboss_cc_test(
364 name = "complex_structure_test",
365 srcs = ["testcode/complex_structure_test.cc"],
366 deps = [
367 "//testdata:complex_structure_emboss",
368 "@com_google_googletest//:gtest_main",
369 ],
370)
Dmitri Primeec162e42020-09-13 23:47:51 -0700371
372emboss_cc_test(
373 name = "complex_offset_test",
374 srcs = ["testcode/complex_offset_test.cc"],
375 deps = [
376 "//testdata:complex_offset_emboss",
377 "@com_google_googletest//:gtest_main",
378 ],
379)