Merge "Restrict IsSanitizerEnabled() to android.Config()."

This commit is contained in:
Treehugger Robot
2022-06-17 15:44:24 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 6 deletions

View File

@@ -1468,7 +1468,7 @@ func (a *apexBundle) EnableSanitizer(sanitizerName string) {
} }
} }
func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool { func (a *apexBundle) IsSanitizerEnabled(config android.Config, sanitizerName string) bool {
if android.InList(sanitizerName, a.properties.SanitizerNames) { if android.InList(sanitizerName, a.properties.SanitizerNames) {
return true return true
} }
@@ -1476,11 +1476,11 @@ func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizer
// Then follow the global setting // Then follow the global setting
globalSanitizerNames := []string{} globalSanitizerNames := []string{}
if a.Host() { if a.Host() {
globalSanitizerNames = ctx.Config().SanitizeHost() globalSanitizerNames = config.SanitizeHost()
} else { } else {
arches := ctx.Config().SanitizeDeviceArch() arches := config.SanitizeDeviceArch()
if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) { if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) {
globalSanitizerNames = ctx.Config().SanitizeDevice() globalSanitizerNames = config.SanitizeDevice()
} }
} }
return android.InList(sanitizerName, globalSanitizerNames) return android.InList(sanitizerName, globalSanitizerNames)

View File

@@ -1289,7 +1289,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
type Sanitizeable interface { type Sanitizeable interface {
android.Module android.Module
IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool IsSanitizerEnabled(config android.Config, sanitizerName string) bool
EnableSanitizer(sanitizerName string) EnableSanitizer(sanitizerName string)
AddSanitizerDependencies(ctx android.BottomUpMutatorContext, sanitizerName string) AddSanitizerDependencies(ctx android.BottomUpMutatorContext, sanitizerName string)
} }
@@ -1427,7 +1427,7 @@ func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) {
} }
} }
} }
} else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled(mctx, t.name()) { } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled(mctx.Config(), t.name()) {
// APEX fuzz modules fall here // APEX fuzz modules fall here
sanitizeable.AddSanitizerDependencies(mctx, t.name()) sanitizeable.AddSanitizerDependencies(mctx, t.name())
mctx.CreateVariations(t.variationName()) mctx.CreateVariations(t.variationName())