From 80d43738f1e4c648ccfc4599e17dc8ba455fe1ea Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 14 Mar 2020 16:42:00 +0100 Subject: 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 --- prog/hints.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'prog/hints.go') diff --git a/prog/hints.go b/prog/hints.go index f7f9dc487..9a5675b1b 100644 --- a/prog/hints.go +++ b/prog/hints.go @@ -66,7 +66,12 @@ func (p *Prog) MutateWithHints(callIndex int, comps CompMap, exec func(p *Prog)) p = p.Clone() c := p.Calls[callIndex] execValidate := func() { - p.Target.SanitizeCall(c) + // Don't try to fix the candidate program. + // Assuming the original call was sanitized, we've got a bad call + // as the result of hint substitution, so just throw it away. + if p.Target.sanitize(c, false) != nil { + return + } p.debugValidate() exec(p) } -- cgit mrf-deployment