diff options
Diffstat (limited to 'cc/compiler.go')
| -rw-r--r-- | cc/compiler.go | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/cc/compiler.go b/cc/compiler.go index 1ced451fa..c1a8d96d8 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -241,12 +241,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { // Return true if the module is in the WarningAllowedProjects. func warningsAreAllowed(subdir string) bool { subdir += "/" - for _, prefix := range config.WarningAllowedProjects { - if strings.HasPrefix(subdir, prefix) { - return true - } - } - return false + return android.HasAnyPrefix(subdir, config.WarningAllowedProjects) } func addToModuleList(ctx ModuleContext, key android.OnceKey, module string) { @@ -515,7 +510,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps // Exclude directories from manual binder interface whitelisting. //TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths. - if android.PrefixInList(ctx.ModuleDir(), allowedManualInterfacePaths) { + if android.HasAnyPrefix(ctx.ModuleDir(), allowedManualInterfacePaths) { flags.Local.CFlags = append(flags.Local.CFlags, "-DDO_NOT_CHECK_MANUAL_BINDER_INTERFACES") } @@ -604,16 +599,12 @@ var thirdPartyDirPrefixExceptions = []*regexp.Regexp{ func isThirdParty(path string) bool { thirdPartyDirPrefixes := []string{"external/", "vendor/", "hardware/"} - for _, prefix := range thirdPartyDirPrefixes { - if strings.HasPrefix(path, prefix) { - for _, prefix := range thirdPartyDirPrefixExceptions { - if prefix.MatchString(path) { - return false - } + if android.HasAnyPrefix(path, thirdPartyDirPrefixes) { + for _, prefix := range thirdPartyDirPrefixExceptions { + if prefix.MatchString(path) { + return false } - break } } - return true } |