Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions rs_bindings_from_cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ _PROFILING_RUSTC_FLAGS = select({
"//conditions:default": [],
})

# Undefine NDEBUG to ensure assertions (including inlined Clang AST assertions)
# remain active even in opt compilation mode (see b/541930690).
_CRUBIT_COPTS = ["-UNDEBUG"]

rust_bindings_from_cc_binary(
name = "rs_bindings_from_cc",
binary = ":rs_bindings_from_cc_main",
Expand Down Expand Up @@ -93,6 +97,7 @@ crubit_rust_binary(
cc_library(
name = "rs_bindings_from_cc_impl",
srcs = ["rs_bindings_from_cc.cc"],
copts = _CRUBIT_COPTS,
# Defines CRUBIT_HEAP_PROFILING when --define=enable_heap_profiling=1 is passed,
# enabling heap profile recording in rs_bindings_from_cc.cc.
defines = select({
Expand Down Expand Up @@ -123,6 +128,7 @@ cc_library(
name = "generate_bindings_and_metadata",
srcs = ["generate_bindings_and_metadata.cc"],
hdrs = ["generate_bindings_and_metadata.h"],
copts = _CRUBIT_COPTS,
visibility = [
"//cargo:__subpackages__",
],
Expand Down Expand Up @@ -181,6 +187,7 @@ cc_library(
name = "ast_util",
srcs = ["ast_util.cc"],
hdrs = ["ast_util.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":cc_ir",
Expand Down Expand Up @@ -224,6 +231,7 @@ cc_library(
name = "type_map",
srcs = ["type_map.cc"],
hdrs = ["type_map.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":cc_ir",
Expand All @@ -237,6 +245,7 @@ cc_library(
name = "annotations_consumer",
srcs = ["annotations_consumer.cc"],
hdrs = ["annotations_consumer.h"],
copts = _CRUBIT_COPTS,
deps = [
":cc_ir",
"//common:annotation_reader",
Expand All @@ -252,6 +261,7 @@ cc_library(
name = "cmdline",
srcs = ["cmdline.cc"],
hdrs = ["cmdline.h"],
copts = _CRUBIT_COPTS,
visibility = [
"//cargo:__subpackages__",
],
Expand All @@ -277,6 +287,7 @@ cc_library(
cc_library(
name = "cmdline_flags",
hdrs = ["cmdline_flags.h"],
copts = _CRUBIT_COPTS,
deps = [
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/strings:string_view",
Expand Down Expand Up @@ -305,6 +316,7 @@ crubit_cc_test(
cc_library(
name = "decl_importer",
hdrs = ["decl_importer.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
"cc_ir",
Expand Down Expand Up @@ -332,6 +344,7 @@ cc_library(
name = "frontend_action",
srcs = ["frontend_action.cc"],
hdrs = ["frontend_action.h"],
copts = _CRUBIT_COPTS,
deps = [
":ast_consumer",
":decl_importer",
Expand All @@ -346,6 +359,7 @@ cc_library(
name = "ast_consumer",
srcs = ["ast_consumer.cc"],
hdrs = ["ast_consumer.h"],
copts = _CRUBIT_COPTS,
deps = [
":decl_importer",
":importer",
Expand All @@ -359,6 +373,7 @@ cc_library(
name = "importer",
srcs = ["importer.cc"],
hdrs = ["importer.h"],
copts = _CRUBIT_COPTS,
deps = [
":annotations_consumer",
":ast_util",
Expand Down Expand Up @@ -444,6 +459,7 @@ cc_library(
name = "cc_ir",
srcs = ["ir.cc"],
hdrs = ["ir.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":bazel_types",
Expand Down Expand Up @@ -539,6 +555,7 @@ cc_library(
name = "ir_from_cc",
srcs = ["ir_from_cc.cc"],
hdrs = ["ir_from_cc.h"],
copts = _CRUBIT_COPTS,
deps = [
":bazel_types",
":cc_ir",
Expand Down Expand Up @@ -568,6 +585,7 @@ cc_library(
testonly = 1,
srcs = ["ir_from_cc_dependency.cc"],
hdrs = ["ir_from_cc_dependency.h"],
copts = _CRUBIT_COPTS,
deps = [
":bazel_types",
":cc_ir",
Expand All @@ -584,6 +602,7 @@ cc_library(
name = "proto_from_cc",
testonly = 1,
srcs = ["proto_from_cc.cc"],
copts = _CRUBIT_COPTS,
deps = [
":cc_ir",
":cmdline_flags",
Expand Down Expand Up @@ -623,6 +642,7 @@ cc_library(
"src_code_gen_ffi_serialized_proto.cc",
],
hdrs = ["src_code_gen_ffi.h"],
copts = _CRUBIT_COPTS,
deps = [
":profiling",
"//common:cc_ffi_types",
Expand Down Expand Up @@ -650,6 +670,7 @@ cc_library(
name = "src_code_gen",
srcs = ["src_code_gen.cc"],
hdrs = ["src_code_gen.h"],
copts = _CRUBIT_COPTS,
deps = [
":cc_ir",
":profiling",
Expand All @@ -667,6 +688,7 @@ cc_library(
name = "ast_convert",
srcs = ["ast_convert.cc"],
hdrs = ["ast_convert.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":ast_util",
Expand All @@ -686,6 +708,7 @@ cc_library(
name = "recording_diagnostic_consumer",
srcs = ["recording_diagnostic_consumer.cc"],
hdrs = ["recording_diagnostic_consumer.h"],
copts = _CRUBIT_COPTS,
visibility = [
"//:__subpackages__",
],
Expand Down Expand Up @@ -746,6 +769,7 @@ cc_library(
name = "cc_collect_instantiations",
srcs = ["collect_instantiations.cc"],
hdrs = ["collect_instantiations.h"],
copts = _CRUBIT_COPTS,
deps = [
":collect_instantiations", # build_cleaner: keep
"//common:cc_ffi_types",
Expand Down Expand Up @@ -797,6 +821,7 @@ cc_library(
name = "collect_namespaces",
srcs = ["collect_namespaces.cc"],
hdrs = ["collect_namespaces.h"],
copts = _CRUBIT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":bazel_types",
Expand Down
15 changes: 15 additions & 0 deletions rs_bindings_from_cc/importers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ package(
default_visibility = ["//:__subpackages__"],
)

# Undefine NDEBUG to ensure assertions (including inlined Clang AST assertions)
# remain active even in opt compilation mode (see b/541930690).
_CRUBIT_COPTS = ["-UNDEBUG"]

cc_library(
name = "class_template",
srcs = ["class_template.cc"],
hdrs = ["class_template.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:cc_ir",
"//rs_bindings_from_cc:decl_importer",
Expand All @@ -23,6 +28,7 @@ cc_library(
name = "cxx_record",
srcs = ["cxx_record.cc"],
hdrs = ["cxx_record.h"],
copts = _CRUBIT_COPTS,
deps = [
"//common:annotation_reader",
"//common:status_macros",
Expand Down Expand Up @@ -53,6 +59,7 @@ cc_library(
name = "enum",
srcs = ["enum.cc"],
hdrs = ["enum.h"],
copts = _CRUBIT_COPTS,
deps = [
"//lifetime_annotations:type_lifetimes",
"//rs_bindings_from_cc:ast_util",
Expand All @@ -70,6 +77,7 @@ cc_library(
name = "enum_constant",
srcs = ["enum_constant.cc"],
hdrs = ["enum_constant.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:ast_util",
"//rs_bindings_from_cc:cc_ir",
Expand All @@ -85,6 +93,7 @@ cc_library(
name = "var",
srcs = ["var.cc"],
hdrs = ["var.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:ast_util",
"//rs_bindings_from_cc:cc_ir",
Expand All @@ -100,6 +109,7 @@ cc_library(
name = "friend",
srcs = ["friend.cc"],
hdrs = ["friend.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:cc_ir",
"//rs_bindings_from_cc:decl_importer",
Expand All @@ -113,6 +123,7 @@ cc_library(
name = "function",
srcs = ["function.cc"],
hdrs = ["function.h"],
copts = _CRUBIT_COPTS,
deps = [
"//common:annotation_reader",
"//lifetime_annotations",
Expand Down Expand Up @@ -143,6 +154,7 @@ cc_library(
name = "function_template",
srcs = ["function_template.cc"],
hdrs = ["function_template.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:cc_ir",
"//rs_bindings_from_cc:decl_importer",
Expand All @@ -155,6 +167,7 @@ cc_library(
name = "namespace",
srcs = ["namespace.cc"],
hdrs = ["namespace.h"],
copts = _CRUBIT_COPTS,
deps = [
"//rs_bindings_from_cc:ast_util",
"//rs_bindings_from_cc:cc_ir",
Expand All @@ -168,6 +181,7 @@ cc_library(
name = "type_alias",
srcs = ["type_alias.cc"],
hdrs = ["type_alias.h"],
copts = _CRUBIT_COPTS,
deps = [
"//lifetime_annotations:type_lifetimes",
"//rs_bindings_from_cc:ast_util",
Expand All @@ -187,6 +201,7 @@ cc_library(
name = "existing_rust_type",
srcs = ["existing_rust_type.cc"],
hdrs = ["existing_rust_type.h"],
copts = _CRUBIT_COPTS,
deps = [
"//common:annotation_reader",
"//common:status_macros",
Expand Down
Loading