Don't mutate non-property module fields
Setting sanitize and stl to nil in a mutator isn't valid, if any other
mutator creates a variant then the factory method will be called again
to create the new variants and will reset sanitize and stl to non-nil.
Add a property to sanitize and check it everywhere that checked for
sanitize != nil, and set the Stl property.
Bug: 319288033
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: If99d5fa0f088ee4a73cc7dccdab4268618a6009f
diff --git a/cc/cc.go b/cc/cc.go
index 134d89c..740be3a 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1379,17 +1379,11 @@
}
func (c *Module) isCfi() bool {
- if sanitize := c.sanitize; sanitize != nil {
- return Bool(sanitize.Properties.SanitizeMutated.Cfi)
- }
- return false
+ return c.sanitize.isSanitizerEnabled(cfi)
}
func (c *Module) isFuzzer() bool {
- if sanitize := c.sanitize; sanitize != nil {
- return Bool(sanitize.Properties.SanitizeMutated.Fuzzer)
- }
- return false
+ return c.sanitize.isSanitizerEnabled(Fuzzer)
}
func (c *Module) isNDKStubLibrary() bool {