[PATCH] D143804: [bazel] create a clang-tidy binary target
Aaron Siddhartha Mondal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 12 05:02:50 PST 2023
aaronmondal requested changes to this revision.
aaronmondal added a comment.
This revision now requires changes to proceed.
Thanks for addressing. Also, really appreciate the tests 😊
One more thing we'll probably want is configurability of `CLANG_TIDY_ENABLE_STATIC_ANALYZER`, i.e. something along these lines:
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
...
bool_flag(
name = "clang_tidy_enable_static_analyzer",
build_setting_default = True,
)
config_setting(
name = "clang_tidy_static_analyzer_enabled",
flag_values = {":clang_tidy_enable_static_analyzer": True},
)
expand_template(
name = "config",
...
substitutions = select({
"clang_tidy_static_analyzer_enabled": {
"#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 1",
},
"//conditions:default": {
"#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 0",
}),
},
...
)
The CMake build file at https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/CMakeLists.txt conditionally uses the static analyzer flag to disable linking of clangStaticAnalyzerCore and clangStaticAnalyzerFrontend, and to disable the mpi module. We could use a select like above to mirror that behavior in Bazel. This way someone who disables the static analyzer doesn't need to build unnecessary targets.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143804/new/
https://reviews.llvm.org/D143804
More information about the llvm-commits
mailing list