xref: /llvm-project/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl (revision 684ca6a25ae0a4b8d015ed321f7e99cb7153951e)
1# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2# See https://llvm.org/LICENSE.txt for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5load("@bazel_skylib//lib:paths.bzl", "paths")
6load("@rules_cc//cc:defs.bzl", "cc_library")
7
8_common_library_deps = [
9    "//clang:ast",
10    "//clang:ast_matchers",
11    "//clang:basic",
12    "//clang:lex",
13    "//clang:frontend",
14    "//llvm:FrontendOpenMP",
15    "//llvm:Support",
16]
17
18def clang_tidy_library(name, **kwargs):
19    kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")], allow_empty = True))
20    kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")], allow_empty = True))
21    kwargs["deps"] = kwargs.get("deps", []) + _common_library_deps
22    cc_library(
23        name = name,
24        **kwargs
25    )
26