diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-05-04 08:58:32 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-05-04 20:56:20 +0200 |
| commit | a4d38b39a8e23244bea7a53e9d7a759474f85dae (patch) | |
| tree | 6bdb1f795fc5b670c9d2bad96599820cdb1eea85 /prog/target.go | |
| parent | 58ae5e18624eaaac79cab00e63d6f32c9bd64ee0 (diff) | |
prog: support disabled attribute
Update #477
Update #502
Diffstat (limited to 'prog/target.go')
| -rw-r--r-- | prog/target.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/prog/target.go b/prog/target.go index 8999f25ac..af03dc47f 100644 --- a/prog/target.go +++ b/prog/target.go @@ -65,6 +65,10 @@ type Target struct { // Maps resource name to a list of calls that can create the resource. resourceCtors map[string][]*Syscall any anyTypes + + // The default ChoiceTable is used only by tests and utilities, so we initialize it lazily. + defaultOnce sync.Once + defaultChoiceTable *ChoiceTable } const maxSpecialPointers = 16 @@ -195,6 +199,13 @@ func restoreLinks(syscalls []*Syscall, resources []*ResourceDesc, types []Type) return resourceMap } +func (target *Target) DefaultChoiceTable() *ChoiceTable { + target.defaultOnce.Do(func() { + target.defaultChoiceTable = target.BuildChoiceTable(nil, nil) + }) + return target.defaultChoiceTable +} + type Gen struct { r *randGen s *state |
