diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-20 11:31:24 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-21 21:26:19 +0200 |
commit | eae03ccd7f8574c176f386e3bfb30d4bd949ee11 (patch) | |
tree | a5634b0775972fe047789accbdac50510d12487a /src | |
parent | 8a889a8e5dfc53c594ed7a004bc1cd48b9998e85 (diff) |
Make QV4::CompiledData::Location hashable
Change-Id: I0e1b84e3a7e656bb816dd2ff6a22b135db0de962
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 <functional> +#include <QtCore/qhashfunctions.h> #include <QtCore/qstring.h> #include <QtCore/qscopeguard.h> #include <QtCore/qvector.h> @@ -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"); |