Merge "Make java_fuzz_host not implement Sanitizeable."
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 53169de..d6fcdb2 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -968,23 +968,21 @@
return true
})
}
- } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok {
+ } else if jniSanitizeable, ok := mctx.Module().(JniSanitizeable); ok {
// If it's a Java module with native dependencies through jni,
// set the sanitizer for them
- if jniSanitizeable, ok := mctx.Module().(JniSanitizeable); ok {
- if jniSanitizeable.IsSanitizerEnabledForJni(mctx, t.name()) {
- mctx.VisitDirectDeps(func(child android.Module) {
- if c, ok := child.(PlatformSanitizeable); ok &&
- mctx.OtherModuleDependencyTag(child) == JniFuzzLibTag &&
- c.SanitizePropDefined() &&
- !c.SanitizeNever() &&
- !c.IsSanitizerExplicitlyDisabled(t) {
- c.SetSanitizeDep(true)
- }
- })
- }
+ if jniSanitizeable.IsSanitizerEnabledForJni(mctx, t.name()) {
+ mctx.VisitDirectDeps(func(child android.Module) {
+ if c, ok := child.(PlatformSanitizeable); ok &&
+ mctx.OtherModuleDependencyTag(child) == JniFuzzLibTag &&
+ c.SanitizePropDefined() &&
+ !c.SanitizeNever() &&
+ !c.IsSanitizerExplicitlyDisabled(t) {
+ c.SetSanitizeDep(true)
+ }
+ })
}
-
+ } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok {
// If an APEX module includes a lib which is enabled for a sanitizer T, then
// the APEX module is also enabled for the same sanitizer type.
mctx.VisitDirectDeps(func(child android.Module) {
@@ -1529,12 +1527,10 @@
if !Bool(sanitize.Properties.Sanitize.Address) &&
!Bool(sanitize.Properties.Sanitize.Hwaddress) &&
!Bool(sanitize.Properties.Sanitize.Fuzzer) &&
-
(Bool(sanitize.Properties.Sanitize.Integer_overflow) ||
len(sanitize.Properties.Sanitize.Misc_undefined) > 0 ||
Bool(sanitize.Properties.Sanitize.Undefined) ||
Bool(sanitize.Properties.Sanitize.All_undefined)) &&
-
!(Bool(sanitize.Properties.Sanitize.Diag.Integer_overflow) ||
Bool(sanitize.Properties.Sanitize.Diag.Cfi) ||
Bool(sanitize.Properties.Sanitize.Diag.Undefined) ||
diff --git a/java/fuzz.go b/java/fuzz.go
index 584c80b..cf2c981 100644
--- a/java/fuzz.go
+++ b/java/fuzz.go
@@ -50,9 +50,10 @@
jniFilePaths android.Paths
}
-// IsSanitizerEnabled implemented to make JavaFuzzLibrary implement
-// cc.Sanitizeable
-func (j *JavaFuzzLibrary) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
+// IsSanitizerEnabledForJni implemented to make JavaFuzzLibrary implement
+// cc.JniSanitizeable. It returns a bool for whether a cc dependency should be
+// sanitized for the given sanitizer or not.
+func (j *JavaFuzzLibrary) IsSanitizerEnabledForJni(ctx android.BaseModuleContext, sanitizerName string) bool {
for _, s := range j.jniProperties.Sanitizers {
if sanitizerName == s {
return true
@@ -61,26 +62,6 @@
return false
}
-// IsSanitizerEnabledForJni implemented to make JavaFuzzLibrary implement
-// cc.JniSanitizeable. It returns a bool for whether a cc dependency should be
-// sanitized for the given sanitizer or not.
-func (j *JavaFuzzLibrary) IsSanitizerEnabledForJni(ctx android.BaseModuleContext, sanitizerName string) bool {
- return j.IsSanitizerEnabled(ctx, sanitizerName)
-}
-
-// EnableSanitizer implemented to make JavaFuzzLibrary implement
-// cc.Sanitizeable
-func (j *JavaFuzzLibrary) EnableSanitizer(sanitizerName string) {
-}
-
-// AddSanitizerDependencies implemented to make JavaFuzzLibrary implement
-// cc.Sanitizeable
-func (j *JavaFuzzLibrary) AddSanitizerDependencies(mctx android.BottomUpMutatorContext, sanitizerName string) {
-}
-
-// To verify that JavaFuzzLibrary implements cc.Sanitizeable
-var _ cc.Sanitizeable = (*JavaFuzzLibrary)(nil)
-
func (j *JavaFuzzLibrary) DepsMutator(mctx android.BottomUpMutatorContext) {
if len(j.jniProperties.Jni_libs) > 0 {
if j.fuzzPackagedModule.FuzzProperties.Fuzz_config == nil {