Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- DWARF.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 LLD_DWARF_H
0010 #define LLD_DWARF_H
0011 
0012 #include "lld/Common/LLVM.h"
0013 #include "llvm/ADT/DenseMap.h"
0014 #include "llvm/ADT/StringRef.h"
0015 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
0016 #include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
0017 #include <memory>
0018 #include <string>
0019 
0020 namespace llvm {
0021 struct DILineInfo;
0022 } // namespace llvm
0023 
0024 namespace lld {
0025 
0026 class DWARFCache {
0027 public:
0028   DWARFCache(std::unique_ptr<llvm::DWARFContext> dwarf);
0029   std::optional<llvm::DILineInfo> getDILineInfo(uint64_t offset,
0030                                                 uint64_t sectionIndex);
0031   std::optional<std::pair<std::string, unsigned>>
0032   getVariableLoc(StringRef name);
0033 
0034   llvm::DWARFContext *getContext() { return dwarf.get(); }
0035 
0036 private:
0037   std::unique_ptr<llvm::DWARFContext> dwarf;
0038   std::vector<const llvm::DWARFDebugLine::LineTable *> lineTables;
0039   struct VarLoc {
0040     const llvm::DWARFDebugLine::LineTable *lt;
0041     unsigned file;
0042     unsigned line;
0043   };
0044   llvm::DenseMap<StringRef, VarLoc> variableLoc;
0045 };
0046 
0047 } // namespace lld
0048 
0049 #endif