Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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("@rules_cc//cc:defs.bzl", "cc_library")

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
)

licenses(["notice"])

cc_library(
name = "lib",
srcs = glob(["*.cpp"]),
hdrs = glob(["*.h"]),
deps = [
"//clang:ast",
"//clang:ast_matchers",
"//clang:ast_matchers_dynamic",
"//clang:basic",
"//clang:frontend",
"//clang:serialization",
"//llvm:LineEditor",
"//llvm:Support",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,37 @@ bool_flag(
build_setting_default = True,
)

bool_flag(
name = "enable_custom_checks",
build_setting_default = True,
)

config_setting(
name = "static_analyzer_enabled",
flag_values = {
":enable_static_analyzer": "true",
},
)

config_setting(
name = "custom_checks_enabled",
flag_values = {
":enable_custom_checks": "true",
},
)

expand_template(
name = "config",
out = "clang-tidy-config.h",
substitutions =
{
"#cmakedefine01 CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS": "#define CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS 0",
} | select({
select({
":custom_checks_enabled": {
"#cmakedefine01 CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS": "#define CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS 1",
},
"//conditions:default": {
"#cmakedefine01 CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS": "#define CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS 0",
},
}) | select({
":static_analyzer_enabled": {
"#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 1",
},
Expand Down Expand Up @@ -208,6 +225,15 @@ clang_tidy_library(
],
)

clang_tidy_library(
name = "custom",
deps = [
":lib",
"//clang:ast_matchers_dynamic",
"//clang-tools-extra/clang-query:lib",
],
)

clang_tidy_library(
name = "concurrency",
deps = [":lib"],
Expand Down Expand Up @@ -365,6 +391,9 @@ CHECKS = [
] + select({
":static_analyzer_enabled": [":mpi"],
"//conditions:default": [],
}) + select({
":custom_checks_enabled": [":custom"],
"//conditions:default": [],
})

cc_library(
Expand Down
Loading