1 //===- TpiHashing.h ---------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_TPIHASHING_H
10 #define LLVM_DEBUGINFO_PDB_TPIHASHING_H
12 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
13 #include "llvm/Support/Error.h"
18 Expected<uint32_t> hashTypeRecord(const llvm::codeview::CVType &Type);
20 struct TagRecordHash {
21 explicit TagRecordHash(codeview::ClassRecord CR, uint32_t Full,
23 : FullRecordHash(Full), ForwardDeclHash(Forward), Class(std::move(CR)) {
27 explicit TagRecordHash(codeview::EnumRecord ER, uint32_t Full,
29 : FullRecordHash(Full), ForwardDeclHash(Forward), Enum(std::move(ER)) {
33 explicit TagRecordHash(codeview::UnionRecord UR, uint32_t Full,
35 : FullRecordHash(Full), ForwardDeclHash(Forward), Union(std::move(UR)) {
39 uint32_t FullRecordHash;
40 uint32_t ForwardDeclHash;
42 codeview::TagRecord &getRecord() {
51 llvm_unreachable("unreachable!");
56 codeview::ClassRecord Class;
57 codeview::EnumRecord Enum;
58 codeview::UnionRecord Union;
64 /// Given a CVType referring to a class, structure, union, or enum, compute
65 /// the hash of its forward decl and full decl.
66 Expected<TagRecordHash> hashTagRecord(const codeview::CVType &Type);
68 } // end namespace pdb
69 } // end namespace llvm
71 #endif // LLVM_DEBUGINFO_PDB_TPIHASHING_H