Skip to content

Commit

Permalink
pw_toolchains: clang-tidy path support
Browse files Browse the repository at this point in the history
- Add support for passing clang_tidy_path variable from invoker to
  static_analyis toolchain and clang-tidy python wrapper script.

Fixed: b/265675177
Change-Id: I375085003706eac17a60b138a1b361b908d3119f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126570
Commit-Queue: Shaun Carnegie <[email protected]>
Reviewed-by: Wyatt Hepler <[email protected]>
  • Loading branch information
shauncarnegie authored and CQ Bot Account committed Jan 19, 2023
1 parent 782bab0 commit de048d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pw_toolchain/static_analysis_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ declare_args() {
# Args:
# cc: (required) String indicating the C compiler to use.
# cxx: (required) String indicating the C++ compiler to use.
# clang_tidy_path: (optional) String indicating clang-tidy bin to use.
template("pw_static_analysis_toolchain") {
invoker_toolchain_args = invoker.defaults

Expand All @@ -72,6 +73,11 @@ template("pw_static_analysis_toolchain") {
_skip_include_path =
_skip_include_path + " --skip-include-path '${pattern}'"
}
_clang_tidy_path = ""
if (defined(invoker.clang_tidy_path)) {
_clang_tidy_path =
"--clang-tidy " + rebase_path(invoker.clang_tidy_path, root_build_dir)
}

toolchain(target_name) {
# Uncomment this line to see which toolchains generate other toolchains.
Expand All @@ -98,6 +104,7 @@ template("pw_static_analysis_toolchain") {
_clang_tidy_py,
_source_exclude,
_skip_include_path,
_clang_tidy_path,
"--source-file {{source}}",
"--source-root '${_source_root}'",
"--export-fixes {{output}}.yaml",
Expand Down Expand Up @@ -126,6 +133,7 @@ template("pw_static_analysis_toolchain") {
_clang_tidy_py,
_source_exclude,
_skip_include_path,
_clang_tidy_path,
"--source-file {{source}}",
"--source-root '${_source_root}'",
"--export-fixes {{output}}.yaml",
Expand Down

0 comments on commit de048d8

Please sign in to comment.