#pragma once // // This file is distributed under the MIT License. See LICENSE.md for details. // #include "llvm/Object/Binary.h" #include "revng/Model/Binary.h" class DwarfImporter { private: TupleTree &Model; std::vector LoadedFiles; using DwarfID = std::pair; std::map DwarfToModel; public: DwarfImporter(TupleTree &Model) : Model(Model) {} public: model::QualifiedType *findType(DwarfID ID) { auto It = DwarfToModel.find(ID); return It == DwarfToModel.end() ? nullptr : &It->second; } const model::QualifiedType & recordType(DwarfID ID, const model::QualifiedType &QT) { revng_assert(DwarfToModel.count(ID) == 0); return DwarfToModel.insert({ ID, QT }).first->second; } TupleTree &getModel() { return Model; } public: void import(llvm::StringRef FileName); void import(const llvm::object::Binary &TheBinary, llvm::StringRef FileName); };