From eae03ccd7f8574c176f386e3bfb30d4bd949ee11 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 20 Oct 2020 11:31:24 +0200 Subject: Make QV4::CompiledData::Location hashable Change-Id: I0e1b84e3a7e656bb816dd2ff6a22b135db0de962 Reviewed-by: Fabian Kosmale --- src/qml/common/qv4compileddata_p.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/qml/common') diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index d46fd58bc8..afb4018c8a 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -52,6 +52,7 @@ #include +#include #include #include #include @@ -146,6 +147,13 @@ struct Location return line < other.line || (line == other.line && column < other.column); } + + friend size_t qHash(const Location &location, size_t seed = 0) + { + return QT_PREPEND_NAMESPACE(qHash)(location._dummy, seed); + } + + friend bool operator==(const Location &a, const Location &b) { return a._dummy == b._dummy; } }; static_assert(sizeof(Location) == 4, "Location structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); -- cgit v1.2.3