diff options
Diffstat (limited to 'lib/ReaderWriter/MachO/File.h')
-rw-r--r-- | lib/ReaderWriter/MachO/File.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/ReaderWriter/MachO/File.h b/lib/ReaderWriter/MachO/File.h index 64a0fcf828442..2bdd6342b4774 100644 --- a/lib/ReaderWriter/MachO/File.h +++ b/lib/ReaderWriter/MachO/File.h @@ -11,11 +11,13 @@ #define LLD_READER_WRITER_MACHO_FILE_H #include "Atoms.h" +#include "DebugInfo.h" #include "MachONormalizedFile.h" #include "lld/Core/SharedLibraryFile.h" #include "lld/Core/Simple.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/Format.h" #include <unordered_map> namespace lld { @@ -25,11 +27,15 @@ using lld::mach_o::normalized::Section; class MachOFile : public SimpleFile { public: + + /// Real file constructor - for on-disk files. MachOFile(std::unique_ptr<MemoryBuffer> mb, MachOLinkingContext *ctx) : SimpleFile(mb->getBufferIdentifier(), File::kindMachObject), _mb(std::move(mb)), _ctx(ctx) {} - MachOFile(StringRef path) : SimpleFile(path, File::kindMachObject) {} + /// Dummy file constructor - for virtual files. + MachOFile(StringRef path) + : SimpleFile(path, File::kindMachObject) {} void addDefinedAtom(StringRef name, Atom::Scope scope, DefinedAtom::ContentType type, DefinedAtom::Merge merge, @@ -225,6 +231,13 @@ public: return F->kind() == File::kindMachObject; } + void setDebugInfo(std::unique_ptr<DebugInfo> debugInfo) { + _debugInfo = std::move(debugInfo); + } + + DebugInfo* debugInfo() const { return _debugInfo.get(); } + std::unique_ptr<DebugInfo> takeDebugInfo() { return std::move(_debugInfo); } + protected: std::error_code doParse() override { // Convert binary file to normalized mach-o. @@ -265,6 +278,7 @@ private: MachOLinkingContext::objc_unknown; uint32_t _swiftVersion = 0; normalized::FileFlags _flags = llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS; + std::unique_ptr<DebugInfo> _debugInfo; }; class MachODylibFile : public SharedLibraryFile { @@ -297,7 +311,7 @@ public: _reExportedDylibs.emplace_back(dylibPath); } - StringRef installName() { return _installName; } + StringRef installName() const { return _installName; } uint32_t currentVersion() { return _currentVersion; } uint32_t compatVersion() { return _compatVersion; } |