From 01a648afa0c387309fa1f19eb5620c90a737db97 Mon Sep 17 00:00:00 2001 From: "Lukacs T. Berki" Date: Fri, 17 Jun 2022 08:59:37 +0200 Subject: [PATCH] Restrict IsSanitizerEnabled() to android.Config(). Turns out, the whole context is not needed and then let's not plumb it any further than necessary. Test: Presubmits. Change-Id: I1a25738e5a6ca20dea0d973c2ce435b5e152399b --- apex/apex.go | 8 ++++---- cc/sanitize.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apex/apex.go b/apex/apex.go index beabbc90a..7e913e8fb 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -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) { return true } @@ -1476,11 +1476,11 @@ func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizer // Then follow the global setting globalSanitizerNames := []string{} if a.Host() { - globalSanitizerNames = ctx.Config().SanitizeHost() + globalSanitizerNames = config.SanitizeHost() } else { - arches := ctx.Config().SanitizeDeviceArch() + arches := config.SanitizeDeviceArch() if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) { - globalSanitizerNames = ctx.Config().SanitizeDevice() + globalSanitizerNames = config.SanitizeDevice() } } return android.InList(sanitizerName, globalSanitizerNames) diff --git a/cc/sanitize.go b/cc/sanitize.go index 42a112ed4..da15b59cc 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -1289,7 +1289,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) { type Sanitizeable interface { android.Module - IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool + IsSanitizerEnabled(config android.Config, sanitizerName string) bool EnableSanitizer(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 sanitizeable.AddSanitizerDependencies(mctx, t.name()) mctx.CreateVariations(t.variationName())