[PATCH] D143804: [bazel] create a clang-tidy binary target
Jathu Satkunarajah via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 21:11:19 PST 2023
jathu created this revision.
jathu added reviewers: gchatelet, bkramer.
Herald added a project: All.
jathu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Create a binary target for clang-tidy. Just glob-ing over everything for now — we can
create separate lib targets in the future if needed. Tested by running:
$ bazel run --config=generic_clang @llvm-project//clang-tools-extra:clang-tidy -- --help
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143804
Files:
utils/bazel/llvm-project-overlay/clang-tools-extra/BUILD.bazel
Index: utils/bazel/llvm-project-overlay/clang-tools-extra/BUILD.bazel
===================================================================
--- /dev/null
+++ 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",
+ ],
+)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143804.496656.patch
Type: text/x-patch
Size: 2187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230211/1323aade/attachment.bin>
More information about the llvm-commits
mailing list