#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_COMPILEUNITINDEX_H
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_COMPILEUNITINDEX_H
#include "lldb/Utility/RangeMap.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "PdbSymUid.h"
#include <map>
#include <memory>
#include <optional>
namespace lldb_private {
namespace npdb {
class PdbIndex;
struct CompilandIndexItem {
CompilandIndexItem(PdbCompilandId m_id,
llvm::pdb::ModuleDebugStreamRef debug_stream,
llvm::pdb::DbiModuleDescriptor descriptor);
PdbCompilandId m_id;
llvm::pdb::ModuleDebugStreamRef m_debug_stream;
llvm::pdb::DbiModuleDescriptor m_module_descriptor;
llvm::codeview::StringsAndChecksumsRef m_strings;
std::vector<llvm::StringRef> m_file_list;
std::map<lldb::addr_t, PdbSymUid> m_symbols_by_va;
std::optional<llvm::codeview::Compile3Sym> m_compile_opts;
std::optional<llvm::codeview::ObjNameSym> m_obj_name;
llvm::SmallVector<llvm::codeview::TypeIndex, 5> m_build_info;
std::map<llvm::codeview::TypeIndex, llvm::codeview::InlineeSourceLine>
m_inline_map;
using GlobalLineTable =
lldb_private::RangeDataVector<lldb::addr_t, uint32_t,
std::pair<uint32_t, uint32_t>>;
GlobalLineTable m_global_line_table;
};
class CompileUnitIndex {
PdbIndex &m_index;
llvm::DenseMap<uint16_t, std::unique_ptr<CompilandIndexItem>> m_comp_units;
public:
explicit CompileUnitIndex(PdbIndex &index) : m_index(index) {}
CompilandIndexItem &GetOrCreateCompiland(uint16_t modi);
const CompilandIndexItem *GetCompiland(uint16_t modi) const;
CompilandIndexItem *GetCompiland(uint16_t modi);
llvm::SmallString<64> GetMainSourceFile(const CompilandIndexItem &item) const;
};
}
}
#endif