Add clang-analyzer check if selected.

* WITH_TIDY=1 should not include clang-analyzer-* checks
  because they are too slow.
* Nightly builds will use both WITH_TIDY=1 and
  CLANG_ANALYZER_CHECKS=1.

Bug: 173736193
Test: make with WITH_TIDY=1 and CLANG_ANALYZER_CHECKS=1
Change-Id: I3885fd0e20475ceee5e3798bffc11a61994ac113
This commit is contained in:
Chih-Hung Hsieh 2021-01-19 18:28:18 -08:00
parent 9bd66d1537
commit 04f8d379e6
1 changed files with 9 additions and 4 deletions

View File

@ -29,15 +29,12 @@ func init() {
if override := ctx.Config().Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" { if override := ctx.Config().Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" {
return override return override
} }
return strings.Join([]string{ checks := strings.Join([]string{
"-*", "-*",
"abseil-*", "abseil-*",
"android-*", "android-*",
"bugprone-*", "bugprone-*",
"cert-*", "cert-*",
// clang-analyzer-* check is slow and enables clang-diagnostic-padded,
// which cannot be suppressed yet.
// "clang-analyzer-*",
"clang-diagnostic-unused-command-line-argument", "clang-diagnostic-unused-command-line-argument",
"google-*", "google-*",
"misc-*", "misc-*",
@ -63,6 +60,14 @@ func init() {
// -readability-* // -readability-*
// -zircon-* // -zircon-*
}, ",") }, ",")
// clang-analyzer-* checks are too slow to be in the default for WITH_TIDY=1.
// nightly builds add CLANG_ANALYZER_CHECKS=1 to run those checks.
// Some test code have clang-diagnostic-padded warnings that cannot be
// suppressed, but only by disabling clang-analyzer-optin.performance.*.
if ctx.Config().IsEnvTrue("CLANG_ANALYZER_CHECKS") {
checks += ",clang-analyzer-*,-clang-analyzer-optin.performance.*"
}
return checks
}) })
// There are too many clang-tidy warnings in external and vendor projects. // There are too many clang-tidy warnings in external and vendor projects.