aboutsummaryrefslogtreecommitdiffstats
path: root/prog/analysis.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-18 14:16:07 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-19 21:48:20 +0100
commit6051a5b55247d5b67f36726b0ea43f0e92a6753e (patch)
treec506860785e7064facb9fecdaa03fa33681309b9 /prog/analysis.go
parent4eef71bb2d6b9b0dd4ef30909f09b7eb84aac79d (diff)
prog: combine RequiresBitmasks and RequiresChecksums into RequiredFeatures
Diffstat (limited to 'prog/analysis.go')
-rw-r--r--prog/analysis.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/prog/analysis.go b/prog/analysis.go
index 2d691934a..ea3a98dd0 100644
--- a/prog/analysis.go
+++ b/prog/analysis.go
@@ -136,30 +136,18 @@ func foreachArgImpl(arg Arg, ctx ArgCtx, f func(Arg, *ArgCtx)) {
}
}
-// TODO(dvyukov): combine RequiresBitmasks and RequiresChecksums into a single function
-// to not walk the tree twice. They are always used together anyway.
-func RequiresBitmasks(p *Prog) bool {
- result := false
+func RequiredFeatures(p *Prog) (bitmasks, csums bool) {
for _, c := range p.Calls {
ForeachArg(c, func(arg Arg, _ *ArgCtx) {
if a, ok := arg.(*ConstArg); ok {
if a.Type().BitfieldOffset() != 0 || a.Type().BitfieldLength() != 0 {
- result = true
+ bitmasks = true
}
}
- })
- }
- return result
-}
-
-func RequiresChecksums(p *Prog) bool {
- result := false
- for _, c := range p.Calls {
- ForeachArg(c, func(arg Arg, _ *ArgCtx) {
if _, ok := arg.Type().(*CsumType); ok {
- result = true
+ csums = true
}
})
}
- return result
+ return
}