Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01a648af authored by Lukacs T. Berki's avatar Lukacs T. Berki
Browse files

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
parent 9b012160
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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)
+2 −2
Original line number Diff line number Diff line
@@ -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())