clover/util: add id_type_equals to support symbols with multiple sections
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6569>
diff --git a/src/gallium/frontends/clover/util/functional.hpp b/src/gallium/frontends/clover/util/functional.hpp
index bf374c6..a89c4fc 100644
--- a/src/gallium/frontends/clover/util/functional.hpp
+++ b/src/gallium/frontends/clover/util/functional.hpp
@@ -406,6 +406,30 @@
return { x };
}
+ template<typename T>
+ class id_type_equals_t {
+ public:
+ id_type_equals_t(const uint32_t id, T t) :
+ id(id), type(t) {
+ }
+
+ template<typename X>
+ bool
+ operator()(const X &x) const {
+ return id == x.id && type(x);
+ }
+
+ private:
+ const uint32_t id;
+ type_equals_t<T> type;
+ };
+
+ template<typename T>
+ id_type_equals_t<T>
+ id_type_equals(const uint32_t id, T x) {
+ return { id, x };
+ }
+
struct interval_overlaps {
template<typename T>
bool