mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-27 13:20:34 +00:00
11c256cdcd
After generating syscall description for fidl files using fidlgen, prune all unused structs using the exact same mechanism used by the compiler's check for unused structs. This allows the FIDL compiler to support modular compilation; it does not need to have global knowledge of whether each struct is used or not.
15 lines
400 B
Go
15 lines
400 B
Go
// Copyright 2018 syzkaller project authors. All rights reserved.
|
|
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
|
|
|
package ast
|
|
|
|
func (desc *Description) Filter(predicate func(Node) bool) *Description {
|
|
desc1 := &Description{}
|
|
for _, n := range desc.Nodes {
|
|
if predicate(n) {
|
|
desc1.Nodes = append(desc1.Nodes, n.Clone())
|
|
}
|
|
}
|
|
return desc1
|
|
}
|