Files
codeql/swift/extractor/infra/FilePath.h
Paolo Tranquilli 5e74df3882 Swift: cache file paths
This required a bit of a generalization of `TrapLabelStore` to not
work only with pointers.
2022-07-14 16:32:33 +02:00

25 lines
663 B
C++

#pragma once
#include <string>
namespace codeql {
// wrapper around `std::string` mainly intended to unambiguously go into an `std::variant`
// TODO probably not needed once we can use `std::filesystem::path`
struct FilePath {
FilePath() = default;
FilePath(const std::string& path) : path{path} {}
FilePath(std::string&& path) : path{std::move(path)} {}
std::string path;
bool operator==(const FilePath& other) const { return path == other.path; }
};
} // namespace codeql
namespace std {
template <>
struct hash<codeql::FilePath> {
size_t operator()(const codeql::FilePath& value) { return hash<string>{}(value.path); }
};
} // namespace std