LLVM  11.0.0git
FileEntry.h
Go to the documentation of this file.
1 //===- FileEntry.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_GSYM_FILEENTRY_H
10 #define LLVM_DEBUGINFO_GSYM_FILEENTRY_H
11 
12 #include "llvm/ADT/DenseMapInfo.h"
13 #include "llvm/ADT/Hashing.h"
14 #include <functional>
15 #include <stdint.h>
16 #include <utility>
17 
18 namespace llvm {
19 namespace gsym {
20 
21 /// Files in GSYM are contained in FileEntry structs where we split the
22 /// directory and basename into two different strings in the string
23 /// table. This allows paths to shared commont directory and filename
24 /// strings and saves space.
25 struct FileEntry {
26 
27  /// Offsets in the string table.
28  /// @{
31  /// @}
32 
33  FileEntry() = default;
34  FileEntry(uint32_t D, uint32_t B) : Dir(D), Base(B) {}
35 
36  // Implement operator== so that FileEntry can be used as key in
37  // unordered containers.
38  bool operator==(const FileEntry &RHS) const {
39  return Base == RHS.Base && Dir == RHS.Dir;
40  };
41  bool operator!=(const FileEntry &RHS) const {
42  return Base != RHS.Base || Dir != RHS.Dir;
43  };
44 };
45 
46 } // namespace gsym
47 
48 template <> struct DenseMapInfo<gsym::FileEntry> {
49  static inline gsym::FileEntry getEmptyKey() {
51  return gsym::FileEntry(key, key);
52  }
53  static inline gsym::FileEntry getTombstoneKey() {
55  return gsym::FileEntry(key, key);
56  }
57  static unsigned getHashValue(const gsym::FileEntry &Val) {
60  }
61  static bool isEqual(const gsym::FileEntry &LHS, const gsym::FileEntry &RHS) {
62  return LHS == RHS;
63  }
64 };
65 
66 } // namespace llvm
67 #endif // #ifndef LLVM_DEBUGINFO_GSYM_FILEENTRY_H
bool operator!=(const FileEntry &RHS) const
Definition: FileEntry.h:41
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static gsym::FileEntry getEmptyKey()
Definition: FileEntry.h:49
static unsigned getHashValue(const gsym::FileEntry &Val)
Definition: FileEntry.h:57
uint32_t Dir
Offsets in the string table.
Definition: FileEntry.h:29
static bool isEqual(const gsym::FileEntry &LHS, const gsym::FileEntry &RHS)
Definition: FileEntry.h:61
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static gsym::FileEntry getTombstoneKey()
Definition: FileEntry.h:53
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:599
Files in GSYM are contained in FileEntry structs where we split the directory and basename into two d...
Definition: FileEntry.h:25
FileEntry(uint32_t D, uint32_t B)
Definition: FileEntry.h:34
bool operator==(const FileEntry &RHS) const
Definition: FileEntry.h:38