Skip to content

Commit d2aecc5

Browse files
laltenerenon
authored andcommitted
Treat .h files as as C++ files
1 parent 327c066 commit d2aecc5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clang_tidy/clang_tidy.bzl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,8 @@ def _clang_tidy_aspect_impl(target, ctx):
151151
compilation_context = target[CcInfo].compilation_context
152152

153153
rule_flags = ctx.rule.attr.copts if hasattr(ctx.rule.attr, "copts") else []
154-
safe_flags = {
155-
ACTION_NAMES.cpp_compile: _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.cpp_compile) + rule_flags),
156-
ACTION_NAMES.c_compile: _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.c_compile) + rule_flags),
157-
}
154+
c_flags = _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.c_compile) + rule_flags) + ["-xc"]
155+
cxx_flags = _safe_flags(_toolchain_flags(ctx, ACTION_NAMES.cpp_compile) + rule_flags) + ["-xc++"]
158156

159157
srcs = _rule_sources(ctx)
160158

@@ -165,7 +163,7 @@ def _clang_tidy_aspect_impl(target, ctx):
165163
exe,
166164
additional_deps,
167165
config,
168-
safe_flags[ACTION_NAMES.c_compile if src.extension == "c" else ACTION_NAMES.cpp_compile],
166+
c_flags if src.extension == "c" else cxx_flags,
169167
compilation_context,
170168
src,
171169
target.label.name,

0 commit comments

Comments
 (0)