Merge "No clang-analyzer-* checks by default for generated files"
This commit is contained in:
@@ -646,7 +646,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
OrderOnly: pathDeps,
|
OrderOnly: pathDeps,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"cFlags": moduleToolingFlags,
|
"cFlags": moduleToolingFlags,
|
||||||
"tidyFlags": flags.tidyFlags,
|
"tidyFlags": config.TidyFlagsForSrcFile(srcFile, flags.tidyFlags),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -106,6 +106,7 @@ type PathBasedTidyCheck struct {
|
|||||||
|
|
||||||
const tidyDefault = "${config.TidyDefaultGlobalChecks}"
|
const tidyDefault = "${config.TidyDefaultGlobalChecks}"
|
||||||
const tidyExternalVendor = "${config.TidyExternalVendorChecks}"
|
const tidyExternalVendor = "${config.TidyExternalVendorChecks}"
|
||||||
|
const tidyDefaultNoAnalyzer = "${config.TidyDefaultGlobalChecks},-clang-analyzer-*"
|
||||||
|
|
||||||
// This is a map of local path prefixes to the set of default clang-tidy checks
|
// This is a map of local path prefixes to the set of default clang-tidy checks
|
||||||
// to be used.
|
// to be used.
|
||||||
@@ -139,3 +140,17 @@ func TidyChecksForDir(dir string) string {
|
|||||||
}
|
}
|
||||||
return tidyDefault
|
return tidyDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TidyFlagsForSrcFile(srcFile android.Path, flags string) string {
|
||||||
|
// Disable clang-analyzer-* checks globally for generated source files
|
||||||
|
// because some of them are too huge. Local .bp files can add wanted
|
||||||
|
// clang-analyzer checks through the tidy_checks property.
|
||||||
|
// Need to do this patch per source file, because some modules
|
||||||
|
// have both generated and organic source files.
|
||||||
|
if _, ok := srcFile.(android.WritablePath); ok {
|
||||||
|
if strings.Contains(flags, tidyDefault) {
|
||||||
|
return strings.ReplaceAll(flags, tidyDefault, tidyDefaultNoAnalyzer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user