File indexing completed on 2026-05-10 08:42:41
0001
0002
0003
0004
0005
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 }
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 }
0048
0049 #endif