Call clang-tidy with -quiet unless WITH_TIDY is set.

* Default builds calls clang-tidy only if enabled locally.
  In this case, clang-tidy should be quiet.
* If WITH_TIDY is 1 or true, let clang-tidy emit default messages.
* Even with -quiet and all warnings are suppressed,
  clang-tidy emits one line message of the number of suppressed messages.
  This one-liner could be suppressed in future changes.

Bug: 69051430
Test: default build and build with WITH_TIDY=1
Change-Id: I45303149930b33544e271e6d5eeddf18c9e48d7a
This commit is contained in:
Chih-Hung Hsieh 2017-12-15 20:57:48 -08:00
parent 04bd5080bf
commit dc0c0302e9
1 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,11 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
flags.TidyFlags = append(flags.TidyFlags, headerFilter) flags.TidyFlags = append(flags.TidyFlags, headerFilter)
} }
// If clang-tidy is not enabled globally, add the -quiet flag.
if !ctx.Config().ClangTidy() {
flags.TidyFlags = append(flags.TidyFlags, "-quiet")
}
// We might be using the static analyzer through clang tidy. // We might be using the static analyzer through clang tidy.
// https://bugs.llvm.org/show_bug.cgi?id=32914 // https://bugs.llvm.org/show_bug.cgi?id=32914
flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-D__clang_analyzer__") flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-D__clang_analyzer__")