Files
carbon-lang/toolchain/driver/BUILD
T
Jon Ross-Perkins c451a5004d Add LLVM_SYMBOLIZER_PATH to the standard cc_binary environment. (#2291)
LLVM_SYMBOLIZER_PATH is required if `llvm-symbolizer` isn't in the developer's PATH. This sets it via bazel instead of having a developer handle it. I noticed this because the apt install of clang doesn't put llvm-symbolizer in the PATH.

I'd like to make this the default without putting it everywhere, but I don't see a way to do this intrinsically through [the toolchain](https://bazel.build/docs/cc-toolchain-config-reference), and the [rules_cc/defs.bzl](https://github.com/bazelbuild/rules_cc/blob/main/cc/defs.bzl) remains a thin wrapper around the native cc_binary.

Since I'm adding another env, it seems undesirable to have the macos asan workaround separate. As a consequence, this merges it in. Note bazel doesn't support merging a dict and a select, so it's also necessary to have the two env vars at least mildly aware there's something up (and this could get worse if we end up having more selects).
2022-10-17 14:56:04 -07:00

64 lines
1.6 KiB
Python

# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
load("//bazel/cc_toolchains:defs.bzl", "cc_env")
load("//bazel/fuzzing:rules.bzl", "cc_fuzz_test")
package(default_visibility = ["//visibility:public"])
exports_files(["lit.cfg.py"])
cc_library(
name = "driver",
srcs = ["driver.cpp"],
hdrs = ["driver.h"],
textual_hdrs = ["flags.def"],
deps = [
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:sorting_diagnostic_consumer",
"//toolchain/lexer:tokenized_buffer",
"//toolchain/parser:parse_tree",
"//toolchain/semantics:semantics_ir_factory",
"//toolchain/source:source_buffer",
"@llvm-project//llvm:Support",
],
)
cc_test(
name = "driver_test",
size = "small",
srcs = ["driver_test.cpp"],
deps = [
":driver",
"//common:gtest_main",
"//toolchain/common:yaml_test_helpers",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/lexer:tokenized_buffer_test_helpers",
"@com_google_googletest//:gtest",
"@llvm-project//llvm:Support",
],
)
cc_fuzz_test(
name = "driver_fuzzer",
size = "small",
srcs = ["driver_fuzzer.cpp"],
corpus = glob(["fuzzer_corpus/*"]),
deps = [
":driver",
"@llvm-project//llvm:Support",
],
)
cc_binary(
name = "carbon",
srcs = ["driver_main.cpp"],
env = cc_env(),
deps = [
":driver",
"//common:bazel_working_dir",
"@llvm-project//llvm:Support",
],
)