10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEHASHING_H 11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEHASHING_H 22 #include <type_traits> 41 template <
typename Range>
42 static std::vector<LocallyHashedType>
hashTypes(Range &&Records) {
43 std::vector<LocallyHashedType> Hashes;
45 for (
const auto &R : Records)
51 static std::vector<LocallyHashedType>
53 std::vector<LocallyHashedType> Hashes;
86 std::array<uint8_t, 8>
Hash;
108 template <
typename Range>
109 static std::vector<GloballyHashedType>
hashTypes(Range &&Records) {
110 std::vector<GloballyHashedType> Hashes;
111 for (
const auto &R : Records)
112 Hashes.push_back(
hashType(R, Hashes, Hashes));
119 template <
typename Range>
120 static std::vector<GloballyHashedType>
122 std::vector<GloballyHashedType> IdHashes;
123 for (
const auto &R : Records)
124 IdHashes.push_back(
hashType(R, TypeHashes, IdHashes));
129 static std::vector<GloballyHashedType>
131 std::vector<GloballyHashedType> Hashes;
138 #if defined(_MSC_VER) 142 static_assert(std::is_trivially_copyable<GloballyHashedType>::value,
143 "GloballyHashedType must be trivially copyable so that we can " 144 "reinterpret_cast arrays of hash data to arrays of " 145 "GloballyHashedType");
178 return *
reinterpret_cast<const unsigned *
>(Val.
Hash.data());
199 for (uint8_t
B : V.
Hash) {
const_iterator end(StringRef path)
Get end iterator over path.
static GloballyHashedType hashType(CVType Type, ArrayRef< GloballyHashedType > PreviousTypes, ArrayRef< GloballyHashedType > PreviousIds)
Given a sequence of bytes representing a record, compute a global hash for this record.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
A locally hashed type represents a straightforward hash code of a serialized record.
static bool isEqual(codeview::LocallyHashedType LHS, codeview::LocallyHashedType RHS)
static codeview::GloballyHashedType getTombstoneKey()
static bool isEqual(codeview::GloballyHashedType LHS, codeview::GloballyHashedType RHS)
A class that wrap the SHA1 algorithm.
static codeview::LocallyHashedType Tombstone
static std::vector< GloballyHashedType > hashTypes(Range &&Records)
Given a sequence of combined type and ID records, compute global hashes for each of them...
static LocallyHashedType hashType(ArrayRef< uint8_t > RecordData)
Given a type, compute its local hash.
static std::vector< LocallyHashedType > hashTypes(Range &&Records)
Given a sequence of types, compute all of the local hashes.
static codeview::LocallyHashedType getEmptyKey()
static std::vector< LocallyHashedType > hashTypeCollection(TypeCollection &Types)
A globally hashed type represents a hash value that is sufficient to uniquely identify a record acros...
static codeview::LocallyHashedType Empty
static std::vector< GloballyHashedType > hashTypeCollection(TypeCollection &Types)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void ForEachRecord(TFunc Func)
The instances of the Type class are immutable: once they are created, they are never changed...
size_t size() const
size - Get the array size.
std::array< uint8_t, 8 > Hash
GloballyHashedType(ArrayRef< uint8_t > H)
static codeview::GloballyHashedType Empty
static codeview::GloballyHashedType getEmptyKey()
static std::vector< GloballyHashedType > hashIds(Range &&Records, ArrayRef< GloballyHashedType > TypeHashes)
Given a sequence of combined type and ID records, compute global hashes for each of them...
static unsigned getHashValue(codeview::LocallyHashedType Val)
An opaque object representing a hash code.
void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style, Optional< size_t > Width=None)
ArrayRef< uint8_t > RecordData
static unsigned getHashValue(codeview::GloballyHashedType Val)
GloballyHashedType(StringRef H)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static codeview::GloballyHashedType Tombstone
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
ArrayRef< uint8_t > RecordData
static codeview::LocallyHashedType getTombstoneKey()