diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-01-04 16:02:51 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-01-11 16:30:08 +0100 |
| commit | b720d0fe3c82f726922714b1e9603119e933ad3a (patch) | |
| tree | 5273260c509dd1c5d6afa4c86046b4fd1ee693d4 | |
| parent | d8ad35efe20c008e71b2359a09aee0662ede5eb9 (diff) | |
prog: require stricter resource constructors
This is prog counter-part of the "pkg/compiler: require stricter resource constructors" commit.
| -rw-r--r-- | prog/resources.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/prog/resources.go b/prog/resources.go index 5af129d00..7c7fa1770 100644 --- a/prog/resources.go +++ b/prog/resources.go @@ -46,7 +46,13 @@ func (target *Target) populateResourceCtors() { // Find resources that are created by each call. callsResources := make([][]*ResourceDesc, len(target.Syscalls)) ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) { + if typ.Optional() { + ctx.Stop = true + return + } switch typ1 := typ.(type) { + case *UnionType: + ctx.Stop = true case *ResourceType: if ctx.Dir != DirIn { callsResources[ctx.Meta.ID] = append(callsResources[ctx.Meta.ID], typ1.Desc) |
