Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:42

0001 //===- FileEntry.h ----------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_GSYM_FILEENTRY_H
0010 #define LLVM_DEBUGINFO_GSYM_FILEENTRY_H
0011 
0012 #include "llvm/ADT/DenseMapInfo.h"
0013 #include "llvm/ADT/Hashing.h"
0014 #include <functional>
0015 #include <stdint.h>
0016 
0017 namespace llvm {
0018 namespace gsym {
0019 
0020 /// Files in GSYM are contained in FileEntry structs where we split the
0021 /// directory and basename into two different strings in the string
0022 /// table. This allows paths to shared commont directory and filename
0023 /// strings and saves space.
0024 struct FileEntry {
0025 
0026   /// Offsets in the string table.
0027   /// @{
0028   uint32_t Dir = 0;
0029   uint32_t Base = 0;
0030   /// @}
0031 
0032   FileEntry() = default;
0033   FileEntry(uint32_t D, uint32_t B) : Dir(D), Base(B) {}
0034 
0035   // Implement operator== so that FileEntry can be used as key in
0036   // unordered containers.
0037   bool operator==(const FileEntry &RHS) const {
0038     return Base == RHS.Base && Dir == RHS.Dir;
0039   };
0040   bool operator!=(const FileEntry &RHS) const {
0041     return Base != RHS.Base || Dir != RHS.Dir;
0042   };
0043 };
0044 
0045 } // namespace gsym
0046 
0047 template <> struct DenseMapInfo<gsym::FileEntry> {
0048   static inline gsym::FileEntry getEmptyKey() {
0049     uint32_t key = DenseMapInfo<uint32_t>::getEmptyKey();
0050     return gsym::FileEntry(key, key);
0051   }
0052   static inline gsym::FileEntry getTombstoneKey() {
0053     uint32_t key = DenseMapInfo<uint32_t>::getTombstoneKey();
0054     return gsym::FileEntry(key, key);
0055   }
0056   static unsigned getHashValue(const gsym::FileEntry &Val) {
0057     return llvm::hash_combine(DenseMapInfo<uint32_t>::getHashValue(Val.Dir),
0058                               DenseMapInfo<uint32_t>::getHashValue(Val.Base));
0059   }
0060   static bool isEqual(const gsym::FileEntry &LHS, const gsym::FileEntry &RHS) {
0061     return LHS == RHS;
0062   }
0063 };
0064 
0065 } // namespace llvm
0066 #endif // LLVM_DEBUGINFO_GSYM_FILEENTRY_H