LLVM 23.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
13#include "llvm/ADT/Hashing.h"
15#include <functional>
16#include <stdint.h>
17
18namespace llvm {
19namespace 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.
25struct FileEntry {
26
27 /// Offsets in the string table.
28 /// @{
31 /// @}
32
33 FileEntry() = default;
35
36 /// Returns the on-disk encoded size of a FileEntry for the given string
37 /// offset size. It's different from sizeof(FileEntry) because of padding.
38 static constexpr uint64_t getEncodedSize(uint8_t StringOffsetSize) {
39 return 2 * StringOffsetSize;
40 }
41
42 // Implement operator== so that FileEntry can be used as key in
43 // unordered containers.
44 bool operator==(const FileEntry &RHS) const {
45 return Base == RHS.Base && Dir == RHS.Dir;
46 };
47 bool operator!=(const FileEntry &RHS) const {
48 return Base != RHS.Base || Dir != RHS.Dir;
49 };
50};
51
52} // namespace gsym
53
54template <> struct DenseMapInfo<gsym::FileEntry> {
68 static bool isEqual(const gsym::FileEntry &LHS, const gsym::FileEntry &RHS) {
69 return LHS == RHS;
70 }
71};
72
73} // namespace llvm
74#endif // LLVM_DEBUGINFO_GSYM_FILEENTRY_H
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines DenseMapInfo traits for DenseMap.
Value * RHS
Value * LHS
uint64_t gsym_strp_t
The type of string offset used in the code.
Definition GsymTypes.h:21
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition Hashing.h:592
static unsigned getHashValue(const gsym::FileEntry &Val)
Definition FileEntry.h:63
static bool isEqual(const gsym::FileEntry &LHS, const gsym::FileEntry &RHS)
Definition FileEntry.h:68
static gsym::FileEntry getTombstoneKey()
Definition FileEntry.h:59
static gsym::FileEntry getEmptyKey()
Definition FileEntry.h:55
An information struct used to provide DenseMap with the various necessary components for a given valu...
Files in GSYM are contained in FileEntry structs where we split the directory and basename into two d...
Definition FileEntry.h:25
static constexpr uint64_t getEncodedSize(uint8_t StringOffsetSize)
Returns the on-disk encoded size of a FileEntry for the given string offset size.
Definition FileEntry.h:38
FileEntry(gsym_strp_t D, gsym_strp_t B)
Definition FileEntry.h:34
bool operator!=(const FileEntry &RHS) const
Definition FileEntry.h:47
bool operator==(const FileEntry &RHS) const
Definition FileEntry.h:44
gsym_strp_t Dir
Offsets in the string table.
Definition FileEntry.h:29