Refactor CC to prep for Rust sanitizable modules.
Adds a PlatformSanitizable interface which both CC and Rust can
implement so that the sanitizer mutators in CC can sanitize Rust
shared/static libraries appropriately.
Bug: 147140513
Test: m nothing
Change-Id: Ib31103b6c4902a4d5df2565c0d7c981298d100a3
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index e3f3a4d..8979846 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -104,7 +104,7 @@
}
func (vendorSnapshotImage) inImage(m *Module) func() bool {
- return m.inVendor
+ return m.InVendor
}
func (vendorSnapshotImage) available(m *Module) *bool {
@@ -507,8 +507,8 @@
}
type snapshotSanitizer interface {
- isSanitizerEnabled(t sanitizerType) bool
- setSanitizerVariation(t sanitizerType, enabled bool)
+ isSanitizerEnabled(t SanitizerType) bool
+ setSanitizerVariation(t SanitizerType, enabled bool)
}
type snapshotLibraryDecorator struct {
@@ -546,7 +546,7 @@
func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
m := ctx.Module().(*Module)
- if m.inVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
+ if m.InVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = vendorSuffix
} else if m.InRecovery() && recoverySuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = recoverySuffix
@@ -613,7 +613,7 @@
return false
}
-func (p *snapshotLibraryDecorator) isSanitizerEnabled(t sanitizerType) bool {
+func (p *snapshotLibraryDecorator) isSanitizerEnabled(t SanitizerType) bool {
switch t {
case cfi:
return p.sanitizerProperties.Cfi.Src != nil
@@ -622,7 +622,7 @@
}
}
-func (p *snapshotLibraryDecorator) setSanitizerVariation(t sanitizerType, enabled bool) {
+func (p *snapshotLibraryDecorator) setSanitizerVariation(t SanitizerType, enabled bool) {
if !enabled {
return
}
@@ -769,7 +769,7 @@
binName := in.Base()
m := ctx.Module().(*Module)
- if m.inVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
+ if m.InVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = vendorSuffix
} else if m.InRecovery() && recoverySuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = recoverySuffix
@@ -868,7 +868,7 @@
m := ctx.Module().(*Module)
- if m.inVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
+ if m.InVendor() && vendorSuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = vendorSuffix
} else if m.InRecovery() && recoverySuffixModules(ctx.Config())[m.BaseModuleName()] {
p.androidMkSuffix = recoverySuffix