Skip to content

Commit 0b86881

Browse files
keitherenon
authored andcommitted
Add support for additional_compiler_inputs
These files are used by things like C++23 `#embed` and therefore might be used by clang-tidy.
1 parent db67701 commit 0b86881

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

clang_tidy/clang_tidy.bzl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ def _run_tidy(
1010
flags,
1111
compilation_contexts,
1212
infile,
13-
discriminator):
13+
discriminator,
14+
additional_inputs):
1415
cc_toolchain = find_cpp_toolchain(ctx)
16+
direct_inputs = (
17+
[infile, config] +
18+
additional_deps.files.to_list() +
19+
([exe.files_to_run.executable] if exe.files_to_run.executable else [])
20+
)
21+
for additional_input in additional_inputs:
22+
direct_inputs.extend(additional_input.files.to_list())
23+
1524
inputs = depset(
16-
direct = (
17-
[infile, config] +
18-
additional_deps.files.to_list() +
19-
([exe.files_to_run.executable] if exe.files_to_run.executable else [])
20-
),
25+
direct = direct_inputs,
2126
transitive =
2227
[compilation_context.headers for compilation_context in compilation_contexts] +
2328
[cc_toolchain.all_files],
@@ -226,6 +231,7 @@ def _clang_tidy_aspect_impl(target, ctx):
226231
compilation_contexts,
227232
src,
228233
target.label.name,
234+
additional_inputs = getattr(ctx.rule.attr, "additional_compiler_inputs", []),
229235
)
230236
for src in srcs
231237
]

0 commit comments

Comments
 (0)