diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-03-14 16:42:00 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-03-17 21:19:13 +0100 |
| commit | 80d43738f1e4c648ccfc4599e17dc8ba455fe1ea (patch) | |
| tree | a2adb84b67e9d760a35fee40ddf06d271f70bab1 /prog/prog.go | |
| parent | a2f9a446496d23c4bf6db95e0d4337583595c78c (diff) | |
prog: rename target.SanitizeCall to Neutralize
We will need a wrapper for target.SanitizeCall that will do more
than just calling the target-provided function. To avoid confusion
and potential mistakes, give the target function and prog function
different names. Prog package will continue to call this "sanitize",
which will include target's "neutralize" + more.
Also refactor API a bit: we need a helper function that sanitizes
the whole program because that's needed most of the time.
Fixes #477
Fixes #502
Diffstat (limited to 'prog/prog.go')
| -rw-r--r-- | prog/prog.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/prog/prog.go b/prog/prog.go index 575f0da9b..1600c0a28 100644 --- a/prog/prog.go +++ b/prog/prog.go @@ -387,3 +387,18 @@ func (p *Prog) removeCall(idx int) { copy(p.Calls[idx:], p.Calls[idx+1:]) p.Calls = p.Calls[:len(p.Calls)-1] } + +func (p *Prog) sanitizeFix() { + if err := p.sanitize(true); err != nil { + panic(err) + } +} + +func (p *Prog) sanitize(fix bool) error { + for _, c := range p.Calls { + if err := p.Target.sanitize(c, fix); err != nil { + return err + } + } + return nil +} |
