mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 11:10:10 +01:00
Adds all the necessary machinery to our toolchain and Bazel configuration to support ASan. This includes ensuring sufficient debug information is available for backtraces, etc. As part of ASan, it enables UBSan to catch more basic undefined behavior in C++. It also enables more complete checking in ASan for lifetime bugs. These configs can be enabled in any build mode with `--config=asan`. They are also enabled by default in `-c fastbuild` where asserts are also enabled. The goal is to have a single build mode that catches the overwhelming majority of correctness issues. Leak checking is part of ASan and finds leaks in `executable_semantics` code that probably aren't interesting to fix right now. I've disabled leak checking in the `BUILD` file for the test that showed this -- everything else passed. If more things need this disabled, the same `BUILD` change should be easily replicated. If you see unsymbolized backtraces, you may need to either put `llvm-symbolizer` on your path, or point the `ASAN_SYMBOLIZER_PATH` environment variable at it. For example, in the project root you could do something like the following to use the downloaded toolchain's symbolizer: ```bash export ASAN_SYMBOLIZER_PATH=$PWD/bazel-clang-toolchain/bin/llvm-symbolizer ``` I'll try to update documentation soon with this as well.