aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/const_file.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-09-14 18:03:44 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-10-04 09:27:33 +0000
commitc4dc646bee41c7e983a13750652f1035ae27b737 (patch)
tree41628c9297a3fe6937dc0b1d2204b7b7d6eee4de /pkg/compiler/const_file.go
parent12dde47641ed4c314decd0728d9d54ba6cd0aa02 (diff)
pkg/compiler: add ExistsAny() to ConstFile
The new method checks whether the value is defined for at least one of the known arches. Refactor ConstFile tests.
Diffstat (limited to 'pkg/compiler/const_file.go')
-rw-r--r--pkg/compiler/const_file.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/compiler/const_file.go b/pkg/compiler/const_file.go
index 0df0bb0ca..1968092a4 100644
--- a/pkg/compiler/const_file.go
+++ b/pkg/compiler/const_file.go
@@ -82,6 +82,10 @@ func (cf *ConstFile) Arch(arch string) map[string]uint64 {
return m
}
+func (cf *ConstFile) ExistsAny(constName string) bool {
+ return len(cf.m[constName].vals) > 0
+}
+
func (cf *ConstFile) Serialize() []byte {
if len(cf.arches) == 0 {
return nil