LLVM 22.0.0git
TpiHashing.h
Go to the documentation of this file.
1//===- TpiHashing.h ---------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_PDB_NATIVE_TPIHASHING_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_TPIHASHING_H
11
14#include "llvm/Support/Error.h"
15
16namespace llvm {
17namespace pdb {
18
19LLVM_ABI Expected<uint32_t> hashTypeRecord(const llvm::codeview::CVType &Type);
20
23 uint32_t Forward)
24 : FullRecordHash(Full), ForwardDeclHash(Forward), Class(std::move(CR)) {
25 State = 0;
26 }
27
29 uint32_t Forward)
30 : FullRecordHash(Full), ForwardDeclHash(Forward), Enum(std::move(ER)) {
31 State = 1;
32 }
33
35 uint32_t Forward)
36 : FullRecordHash(Full), ForwardDeclHash(Forward), Union(std::move(UR)) {
37 State = 2;
38 }
39
42
44 switch (State) {
45 case 0:
46 return Class;
47 case 1:
48 return Enum;
49 case 2:
50 return Union;
51 }
52 llvm_unreachable("unreachable!");
53 }
54
55private:
56 union {
60 };
61
62 uint8_t State = 0;
63};
64
65/// Given a CVType referring to a class, structure, union, or enum, compute
66/// the hash of its forward decl and full decl.
68
69} // end namespace pdb
70} // end namespace llvm
71
72#endif // LLVM_DEBUGINFO_PDB_NATIVE_TPIHASHING_H
#define LLVM_ABI
Definition Compiler.h:213
Tagged union holding either a T or a Error.
Definition Error.h:485
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
LLVM_ABI Expected< uint32_t > hashTypeRecord(const llvm::codeview::CVType &Type)
LLVM_ABI Expected< TagRecordHash > hashTagRecord(const codeview::CVType &Type)
Given a CVType referring to a class, structure, union, or enum, compute the hash of its forward decl ...
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1849
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851
codeview::ClassRecord Class
Definition TpiHashing.h:57
codeview::EnumRecord Enum
Definition TpiHashing.h:58
TagRecordHash(codeview::UnionRecord UR, uint32_t Full, uint32_t Forward)
Definition TpiHashing.h:34
TagRecordHash(codeview::EnumRecord ER, uint32_t Full, uint32_t Forward)
Definition TpiHashing.h:28
codeview::TagRecord & getRecord()
Definition TpiHashing.h:43
codeview::UnionRecord Union
Definition TpiHashing.h:59
TagRecordHash(codeview::ClassRecord CR, uint32_t Full, uint32_t Forward)
Definition TpiHashing.h:22