Skip to content

Commit a59b65b

Browse files
committed
Apply buildifier list suggestions to clang
1 parent 978b426 commit a59b65b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/clang.bzl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,14 @@ def _run_analyzer(
215215

216216
def check_valid_file_type(src):
217217
"""
218+
Checks if the file is a cpp related file.
219+
218220
Returns True if the file type matches one of the permitted
219221
srcs file types for C and C++ header/source files.
222+
Args:
223+
src: Path of a single source file.
224+
Returns:
225+
Boolean value.
220226
"""
221227
permitted_file_types = [
222228
".c",
@@ -326,6 +332,8 @@ CompileInfo = provider(
326332
},
327333
)
328334

335+
# buildifier: disable=unused-variable
336+
# The headers variable is used: headers += dep[CompileInfo].headers.to_list()
329337
def _process_all_deps(ctx, arguments, headers):
330338
for attr in SOURCE_ATTR:
331339
if hasattr(ctx.rule.attr, attr):
@@ -391,7 +399,7 @@ compile_info_aspect = aspect(
391399

392400
def _clang_test(ctx, tool):
393401
all_files = []
394-
all_headers = depset()
402+
all_headers_list = []
395403
for target in ctx.attr.targets:
396404
if CompileInfo in target:
397405
if hasattr(target[CompileInfo], "arguments"):
@@ -411,8 +419,9 @@ def _clang_test(ctx, tool):
411419
ctx.attr.name,
412420
)
413421
all_files.append(report)
414-
all_headers = depset(transitive = [all_headers, headers])
422+
all_headers_list.extend(headers.to_list())
415423

424+
all_headers = depset(all_headers_list)
416425
ctx.actions.write(
417426
output = ctx.outputs.test_script,
418427
is_executable = True,

0 commit comments

Comments
 (0)