Vulkan/Debug: Support Locations as hashmap keys

Implement `operator<()`, `std::hash<>`

Bug: b/145351270
Change-Id: I9ebcfccd3a1da36dc9286f6ed6d50c73c8c3bac3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48698
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/Vulkan/Debug/Location.hpp b/src/Vulkan/Debug/Location.hpp
index c924a5a..cb8ce33 100644
--- a/src/Vulkan/Debug/Location.hpp
+++ b/src/Vulkan/Debug/Location.hpp
@@ -30,6 +30,7 @@
 
 	inline bool operator==(const Location &o) const;
 	inline bool operator!=(const Location &o) const;
+	inline bool operator<(const Location &o) const;
 
 	std::shared_ptr<File> file;
 	int line = 0;    // 1 based. 0 represents no line.
@@ -52,7 +53,37 @@
 	return !(*this == o);
 }
 
+bool Location::operator<(const Location &o) const
+{
+	if(file.get() < o.file.get()) { return true; }
+	if(file.get() > o.file.get()) { return false; }
+
+	if(line < o.line) { return true; }
+	if(line > o.line) { return false; }
+
+	if(column < o.column) { return true; }
+	if(column > o.column) { return false; }
+
+	return true;
+}
+
 }  // namespace dbg
 }  // namespace vk
 
-#endif  // VK_DEBUG_LOCATION_HPP_
\ No newline at end of file
+namespace std {
+
+template<>
+struct hash<vk::dbg::Location>
+{
+	size_t operator()(const vk::dbg::Location &l) const
+	{
+		auto h = std::hash<vk::dbg::File *>()(l.file.get());
+		h = h * 31 + l.line;
+		h = h * 31 + l.column;
+		return h;
+	}
+};
+
+}  // namespace std
+
+#endif  // VK_DEBUG_LOCATION_HPP_