LLVM  8.0.1
TpiHashing.h
Go to the documentation of this file.
1 //===- TpiHashing.h ---------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_PDB_TPIHASHING_H
11 #define LLVM_DEBUGINFO_PDB_TPIHASHING_H
12 
14 #include "llvm/Support/Error.h"
15 
16 namespace llvm {
17 namespace pdb {
18 
19 Expected<uint32_t> hashTypeRecord(const llvm::codeview::CVType &Type);
20 
21 struct TagRecordHash {
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 
55 private:
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_TPIHASHING_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Definition: BitVector.h:938
TagRecordHash(codeview::ClassRecord CR, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:22
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
codeview::ClassRecord Class
Definition: TpiHashing.h:57
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:89
TagRecordHash(codeview::UnionRecord UR, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:34
codeview::TagRecord & getRecord()
Definition: TpiHashing.h:43
Expected< uint32_t > hashTypeRecord(const llvm::codeview::CVType &Type)
Definition: TpiHashing.cpp:106
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
TagRecordHash(codeview::EnumRecord ER, uint32_t Full, uint32_t Forward)
Definition: TpiHashing.h:28
codeview::EnumRecord Enum
Definition: TpiHashing.h:58
codeview::UnionRecord Union
Definition: TpiHashing.h:59