Iterate over sanitizers

Test: go test soong tests
Change-Id: If89b7d0b04cad79b42a08504d4fcff36e914b7a4
This commit is contained in:
Liz Kammer
2021-07-07 16:41:50 -04:00
parent 7b920b4057
commit 75db931843
2 changed files with 27 additions and 20 deletions

View File

@@ -79,12 +79,23 @@ const (
Hwasan
tsan
intOverflow
cfi
scs
Fuzzer
memtag_heap
cfi // cfi is last to prevent it running before incompatible mutators
)
var Sanitizers = []SanitizerType{
Asan,
Hwasan,
tsan,
intOverflow,
scs,
Fuzzer,
memtag_heap,
cfi, // cfi is last to prevent it running before incompatible mutators
}
// Name of the sanitizer variation for this sanitizer type
func (t SanitizerType) variationName() string {
switch t {
@@ -133,6 +144,18 @@ func (t SanitizerType) name() string {
}
}
func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
switch t {
case Asan, Hwasan, Fuzzer, scs, tsan, cfi:
ctx.TopDown(t.variationName()+"_deps", sanitizerDepsMutator(t))
ctx.BottomUp(t.variationName(), sanitizerMutator(t))
case memtag_heap, intOverflow:
// do nothing
default:
panic(fmt.Errorf("unknown SanitizerType %d", t))
}
}
func (*Module) SanitizerSupported(t SanitizerType) bool {
switch t {
case Asan: