xref: /aosp_15_r20/external/emboss/compiler/back_end/cpp/BUILD (revision 99e0aae7469b87d12f0ad23e61142c2d74c1ef70)
1# 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
17load("@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")
20load(":build_defs.bzl", "emboss_cc_test")
21
22package(
23    default_visibility = [
24        "//visibility:private",
25    ],
26    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",
36        "//compiler/util:ir_data",
37    ],
38)
39
40py_library(
41    name = "attributes",
42    srcs = ["attributes.py"],
43    deps = [],
44)
45
46py_library(
47    name = "header_generator",
48    srcs = ["header_generator.py"],
49    data = [
50        "generated_code_templates",
51    ],
52    deps = [
53        ":attributes",
54        "//compiler/back_end/util:code_template",
55        "//compiler/util:attribute_util",
56        "//compiler/util:ir_data",
57        "//compiler/util:ir_util",
58        "//compiler/util:name_conversion",
59        "//compiler/util:resources",
60    ],
61)
62
63py_test(
64    name = "header_generator_test",
65    srcs = ["header_generator_test.py"],
66    deps = [
67        ":header_generator",
68        "//compiler/front_end:glue",
69        "//compiler/util:test_util",
70    ],
71)
72
73emboss_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(
129    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(
140    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(
162    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(
173    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 = "no_enum_traits_test",
229    srcs = [
230        "testcode/no_enum_traits_test.cc",
231    ],
232    deps = [
233        "//testdata:no_enum_traits_emboss",
234        "@com_google_googletest//:gtest_main",
235    ],
236)
237
238emboss_cc_test(
239    name = "start_size_range_test",
240    srcs = [
241        "testcode/start_size_range_test.cc",
242    ],
243    deps = [
244        "//testdata:start_size_range_emboss",
245        "@com_google_googletest//:gtest_main",
246    ],
247)
248
249emboss_cc_test(
250    name = "bcd_test",
251    srcs = [
252        "testcode/bcd_test.cc",
253    ],
254    deps = [
255        "//testdata:bcd_emboss",
256        "@com_google_googletest//:gtest_main",
257    ],
258)
259
260emboss_cc_test(
261    name = "namespace_test",
262    srcs = [
263        "testcode/namespace_test.cc",
264    ],
265    deps = [
266        "//testdata:absolute_cpp_namespace_emboss",
267        "//testdata:cpp_namespace_emboss",
268        "//testdata:no_cpp_namespace_emboss",
269        "@com_google_googletest//:gtest_main",
270    ],
271)
272
273emboss_cc_test(
274    name = "requires_test",
275    srcs = [
276        "testcode/requires_test.cc",
277    ],
278    deps = [
279        "//testdata:requires_emboss",
280        "@com_google_googletest//:gtest_main",
281    ],
282)
283
284emboss_cc_test(
285    name = "subtypes_test",
286    srcs = [
287        "testcode/subtypes_test.cc",
288    ],
289    deps = [
290        "//testdata:subtypes_emboss",
291        "@com_google_googletest//:gtest_main",
292    ],
293)
294
295emboss_cc_test(
296    name = "inline_type_test",
297    srcs = [
298        "testcode/inline_type_test.cc",
299    ],
300    deps = [
301        "//testdata:inline_type_emboss",
302        "@com_google_googletest//:gtest_main",
303    ],
304)
305
306emboss_cc_test(
307    name = "bits_test",
308    srcs = [
309        "testcode/bits_test.cc",
310    ],
311    deps = [
312        "//runtime/cpp:cpp_utils",
313        "//testdata:bits_emboss",
314        "@com_google_googletest//:gtest_main",
315    ],
316)
317
318emboss_cc_test(
319    name = "anonymous_bits_test",
320    srcs = [
321        "testcode/anonymous_bits_test.cc",
322    ],
323    deps = [
324        "//runtime/cpp:cpp_utils",
325        "//testdata:anonymous_bits_emboss",
326        "@com_google_googletest//:gtest_main",
327    ],
328)
329
330emboss_cc_test(
331    name = "next_keyword_test",
332    srcs = [
333        "testcode/next_keyword_test.cc",
334    ],
335    deps = [
336        "//testdata:next_keyword_emboss",
337        "@com_google_googletest//:gtest_main",
338    ],
339)
340
341emboss_cc_test(
342    name = "virtual_field_test",
343    srcs = [
344        "testcode/virtual_field_test.cc",
345    ],
346    deps = [
347        "//testdata:virtual_field_emboss",
348        "@com_google_googletest//:gtest_main",
349    ],
350)
351
352emboss_cc_test(
353    name = "text_format_test",
354    srcs = [
355        "testcode/text_format_test.cc",
356    ],
357    deps = [
358        "//testdata:text_format_emboss",
359        "@com_google_googletest//:gtest_main",
360    ],
361)
362
363emboss_cc_test(
364    name = "parameters_test",
365    srcs = [
366        "testcode/parameters_test.cc",
367    ],
368    deps = [
369        "//testdata:parameters_emboss",
370        "@com_google_googletest//:gtest_main",
371    ],
372)
373
374emboss_cc_test(
375    name = "complex_structure_test",
376    srcs = ["testcode/complex_structure_test.cc"],
377    deps = [
378        "//testdata:complex_structure_emboss",
379        "@com_google_googletest//:gtest_main",
380    ],
381)
382
383emboss_cc_test(
384    name = "complex_offset_test",
385    srcs = ["testcode/complex_offset_test.cc"],
386    deps = [
387        "//testdata:complex_offset_emboss",
388        "@com_google_googletest//:gtest_main",
389    ],
390)
391