From 87a99109d46d1ca8b4bd54be6f56b87ddb226f97 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 4 Oct 2024 20:23:56 +0000 Subject: [PATCH] Fix cxxopts passed to C compiles Previously since the fragment's cxxopts were always passed, these were included in validating C files --- clang_tidy/clang_tidy.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang_tidy/clang_tidy.bzl b/clang_tidy/clang_tidy.bzl index 19d2ca8..001fdb6 100644 --- a/clang_tidy/clang_tidy.bzl +++ b/clang_tidy/clang_tidy.bzl @@ -108,10 +108,13 @@ def _toolchain_flags(ctx, action_name = ACTION_NAMES.cpp_compile): ctx = ctx, cc_toolchain = cc_toolchain, ) + user_compile_flags = ctx.fragments.cpp.copts + if action_name == ACTION_NAMES.cpp_compile: + user_compile_flags.extend(ctx.fragments.cpp.cxxopts) compile_variables = cc_common.create_compile_variables( feature_configuration = feature_configuration, cc_toolchain = cc_toolchain, - user_compile_flags = ctx.fragments.cpp.cxxopts + ctx.fragments.cpp.copts, + user_compile_flags = user_compile_flags, ) flags = cc_common.get_memory_inefficient_command_line( feature_configuration = feature_configuration,