Add support for clang-tidy -warnings-as-errors in Android.bp files
Test: manually change Android.bp and checked clang-tidy invocation cmd Change-Id: I51a64b3f7da82428b896f46f739c93d76a050aaf
This commit is contained in:
@@ -31,6 +31,9 @@ type TidyProperties struct {
|
|||||||
|
|
||||||
// Extra checks to enable or disable in clang-tidy
|
// Extra checks to enable or disable in clang-tidy
|
||||||
Tidy_checks []string
|
Tidy_checks []string
|
||||||
|
|
||||||
|
// Checks that should be treated as errors.
|
||||||
|
Tidy_checks_as_errors []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type tidyFeature struct {
|
type tidyFeature struct {
|
||||||
@@ -116,5 +119,9 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
}
|
}
|
||||||
flags.TidyFlags = append(flags.TidyFlags, tidyChecks)
|
flags.TidyFlags = append(flags.TidyFlags, tidyChecks)
|
||||||
|
|
||||||
|
if len(tidy.Properties.Tidy_checks_as_errors) > 0 {
|
||||||
|
tidyChecksAsErrors := "-warnings-as-errors=" + strings.Join(esc(tidy.Properties.Tidy_checks_as_errors), ",")
|
||||||
|
flags.TidyFlags = append(flags.TidyFlags, tidyChecksAsErrors)
|
||||||
|
}
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user