diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/BUILD.bazel new file mode 100644 --- /dev/null +++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/BUILD.bazel @@ -0,0 +1,65 @@ +# This file is licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +load("@bazel_skylib//rules:expand_template.bzl", "expand_template") + +licenses(["notice"]) + +expand_template( + name = "clang-tidy-config", + out = "include/clang-tidy-config.h", + substitutions = { + "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 0", + }, + template = "clang-tidy/clang-tidy-config.h.cmake", +) + +cc_binary( + name = "clang-tidy-confusable-table-builder", + srcs = ["clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp"], + deps = ["//clang:support"], +) + +genrule( + name = "clang-tidy-confusables", + srcs = ["clang-tidy/misc/ConfusableTable/confusables.txt"], + outs = ["include/Confusables.inc"], + cmd = "$(location :clang-tidy-confusable-table-builder) $(SRCS) $(OUTS)", + exec_tools = [":clang-tidy-confusable-table-builder"], +) + +cc_binary( + name = "clang-tidy", + srcs = glob( + [ + "clang-tidy/**/*.cpp", + "clang-tidy/**/*.h", + ], + exclude = ["clang-tidy/misc/ConfusableTable/**/*"], + ) + [ + ":clang-tidy-config", + ":clang-tidy-confusables", + ], + includes = ["include"], + stamp = 0, + visibility = ["//visibility:public"], + deps = [ + "//clang:analysis", + "//clang:ast", + "//clang:ast_matchers", + "//clang:basic", + "//clang:format", + "//clang:frontend", + "//clang:frontend_rewrite", + "//clang:lex", + "//clang:rewrite", + "//clang:sema", + "//clang:serialization", + "//clang:static_analyzer_checkers", + "//clang:support", + "//clang:tooling", + "//clang:tooling_core", + "//clang:transformer", + ], +)