Remove IsDependencyRoot from interface
This is equivalent to Binary() -- reduce the interface and improve clarity. Test: go test soong tests Change-Id: I770f5ce79fd4d888586d31ec5e67be88153626b6
This commit is contained in:
@@ -183,11 +183,6 @@ func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||
return deps
|
||||
}
|
||||
|
||||
func (binary *binaryDecorator) isDependencyRoot() bool {
|
||||
// Binaries are always the dependency root.
|
||||
return true
|
||||
}
|
||||
|
||||
// NewBinary builds and returns a new Module corresponding to a C++ binary.
|
||||
// Individual module implementations which comprise a C++ binary should call this function,
|
||||
// set some fields on the result, and then call the Init function.
|
||||
|
11
cc/cc.go
11
cc/cc.go
@@ -1119,17 +1119,6 @@ func (c *Module) Init() android.Module {
|
||||
return c
|
||||
}
|
||||
|
||||
// Returns true for dependency roots (binaries)
|
||||
// TODO(ccross): also handle dlopenable libraries
|
||||
func (c *Module) IsDependencyRoot() bool {
|
||||
if root, ok := c.linker.(interface {
|
||||
isDependencyRoot() bool
|
||||
}); ok {
|
||||
return root.isDependencyRoot()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) UseVndk() bool {
|
||||
return c.Properties.VndkVersion != ""
|
||||
}
|
||||
|
@@ -14,11 +14,6 @@ type PlatformSanitizeable interface {
|
||||
// SanitizePropDefined returns whether the Sanitizer properties struct for this module is defined.
|
||||
SanitizePropDefined() bool
|
||||
|
||||
// IsDependencyRoot returns whether a module is of a type which cannot be a linkage dependency
|
||||
// of another module. For example, cc_binary and rust_binary represent dependency roots as other
|
||||
// modules cannot have linkage dependencies against these types.
|
||||
IsDependencyRoot() bool
|
||||
|
||||
// IsSanitizerEnabled returns whether a sanitizer is enabled.
|
||||
IsSanitizerEnabled(t SanitizerType) bool
|
||||
|
||||
|
@@ -1250,7 +1250,7 @@ var _ PlatformSanitizeable = (*Module)(nil)
|
||||
func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) {
|
||||
return func(mctx android.BottomUpMutatorContext) {
|
||||
if c, ok := mctx.Module().(PlatformSanitizeable); ok && c.SanitizePropDefined() {
|
||||
if c.IsDependencyRoot() && c.IsSanitizerEnabled(t) {
|
||||
if c.Binary() && c.IsSanitizerEnabled(t) {
|
||||
modules := mctx.CreateVariations(t.variationName())
|
||||
modules[0].(PlatformSanitizeable).SetSanitizer(t, true)
|
||||
} else if c.IsSanitizerEnabled(t) || c.SanitizeDep() {
|
||||
|
@@ -155,7 +155,3 @@ func (binary *binaryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
||||
}
|
||||
return binary.baseCompiler.stdLinkage(ctx)
|
||||
}
|
||||
|
||||
func (binary *binaryDecorator) isDependencyRoot() bool {
|
||||
return true
|
||||
}
|
||||
|
@@ -289,10 +289,6 @@ func (compiler *baseCompiler) CargoOutDir() android.OptionalPath {
|
||||
return android.OptionalPathForPath(compiler.cargoOutDir)
|
||||
}
|
||||
|
||||
func (compiler *baseCompiler) isDependencyRoot() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath {
|
||||
return compiler.strippedOutputFile
|
||||
}
|
||||
|
@@ -172,13 +172,6 @@ func (mod *Module) SanitizePropDefined() bool {
|
||||
return mod.sanitize != nil && mod.compiler != nil
|
||||
}
|
||||
|
||||
func (mod *Module) IsDependencyRoot() bool {
|
||||
if mod.compiler != nil {
|
||||
return mod.compiler.isDependencyRoot()
|
||||
}
|
||||
panic("IsDependencyRoot called on a non-compiler Rust module")
|
||||
}
|
||||
|
||||
func (mod *Module) IsPrebuilt() bool {
|
||||
if _, ok := mod.compiler.(*prebuiltLibraryDecorator); ok {
|
||||
return true
|
||||
@@ -449,7 +442,6 @@ type compiler interface {
|
||||
SetDisabled()
|
||||
|
||||
stdLinkage(ctx *depsContext) RustLinkage
|
||||
isDependencyRoot() bool
|
||||
|
||||
strippedOutputFilePath() android.OptionalPath
|
||||
}
|
||||
|
Reference in New Issue
Block a user