Skip to content

Commit

Permalink
Expand make variables in copts
Browse files Browse the repository at this point in the history
If you have something like `copts = ["-I$(GENDIR)"]` this requires
pre-processing. There are other use cases like this that likely matter
less than this.
  • Loading branch information
keith authored and erenon committed Oct 6, 2024
1 parent 534a3e4 commit cf312e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion clang_tidy/clang_tidy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ def _clang_tidy_aspect_impl(target, ctx):
if hasattr(ctx.rule.attr, "implementation_deps"):
compilation_contexts.extend([implementation_dep[CcInfo].compilation_context for implementation_dep in ctx.rule.attr.implementation_deps])

rule_flags = ctx.rule.attr.copts if hasattr(ctx.rule.attr, "copts") else []
copts = ctx.rule.attr.copts if hasattr(ctx.rule.attr, "copts") else []
rule_flags = []
for copt in copts:
rule_flags.append(ctx.expand_make_variables(
"copts",
copt,
{},
))

c_flags = _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.c_compile) + rule_flags) + ["-xc"]
cxx_flags = _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.cpp_compile) + rule_flags) + ["-xc++"]

Expand Down

0 comments on commit cf312e0

Please sign in to comment.