LLVM  14.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 
13 #include "llvm/Support/Error.h"
14 
15 namespace llvm {
16 namespace pdb {
17 
18 Expected<uint32_t> hashTypeRecord(const llvm::codeview::CVType &Type);
19 
20 struct TagRecordHash {
22  uint32_t Forward)
23  : FullRecordHash(Full), ForwardDeclHash(Forward), Class(std::move(CR)) {
24  State = 0;
25  }
26 
28  uint32_t Forward)
29  : FullRecordHash(Full), ForwardDeclHash(Forward), Enum(std::move(ER)) {
30  State = 1;
31  }
32 
34  uint32_t Forward)
35  : FullRecordHash(Full), ForwardDeclHash(Forward), Union(std::move(UR)) {
36  State = 2;
37  }
38 
41 
43  switch (State) {
44  case 0:
45  return Class;
46  case 1:
47  return Enum;
48  case 2:
49  return Union;
50  }
51  llvm_unreachable("unreachable!");
52  }
53 
54 private:
55  union {
59  };
60 
61  uint8_t State = 0;
62 };
63 
64 /// Given a CVType referring to a class, structure, union, or enum, compute
65 /// the hash of its forward decl and full decl.
67 
68 } // end namespace pdb
69 } // end namespace llvm
70 
71 #endif // LLVM_DEBUGINFO_PDB_NATIVE_TPIHASHING_H
llvm::codeview::TagRecord
Definition: TypeRecord.h:415
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
Error.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::codeview::EnumRecord
Definition: TypeRecord.h:518
llvm::pdb::TagRecordHash::Enum
codeview::EnumRecord Enum
Definition: TpiHashing.h:57
llvm::pdb::hashTagRecord
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 ...
Definition: TpiHashing.cpp:88
llvm::pdb::TagRecordHash::Class
codeview::ClassRecord Class
Definition: TpiHashing.h:56
llvm::pdb::TagRecordHash::TagRecordHash
TagRecordHash(codeview::ClassRecord CR, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:21
llvm::pdb::TagRecordHash::FullRecordHash
uint32_t FullRecordHash
Definition: TpiHashing.h:39
TypeRecord.h
llvm::pdb::TagRecordHash::TagRecordHash
TagRecordHash(codeview::UnionRecord UR, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:33
llvm::move
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:1609
llvm::pdb::hashTypeRecord
Expected< uint32_t > hashTypeRecord(const llvm::codeview::CVType &Type)
Definition: TpiHashing.cpp:105
llvm::codeview::CVRecord< TypeLeafKind >
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
uint32_t
llvm::pdb::TagRecordHash::ForwardDeclHash
uint32_t ForwardDeclHash
Definition: TpiHashing.h:40
llvm::pdb::TagRecordHash
Definition: TpiHashing.h:20
llvm::pdb::TagRecordHash::getRecord
codeview::TagRecord & getRecord()
Definition: TpiHashing.h:42
std
Definition: BitVector.h:838
llvm::codeview::UnionRecord
Definition: TypeRecord.h:497
llvm::pdb::TagRecordHash::TagRecordHash
TagRecordHash(codeview::EnumRecord ER, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:27
llvm::codeview::ClassRecord
Definition: TypeRecord.h:464
llvm::pdb::TagRecordHash::Union
codeview::UnionRecord Union
Definition: TpiHashing.h:58