From f12b82824aca2711b8b2e838341ae7e1b266d213 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 21 Feb 2014 20:10:59 +0000 Subject: Add a SymbolicFile interface between Binary and ObjectFile. This interface allows IRObjectFile to be implemented without having dummy methods for all section and segment related methods. Both llvm-ar and llvm-nm are changed to use it. Unfortunately the mangler is still not plugged in since it requires some refactoring to make a Module hold a DataLayout. llvm-svn: 201881 --- llvm/lib/Object/Binary.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Object/Binary.cpp') diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp index 63898d277f3..c7f868fcdd1 100644 --- a/llvm/lib/Object/Binary.cpp +++ b/llvm/lib/Object/Binary.cpp @@ -42,10 +42,9 @@ StringRef Binary::getFileName() const { } ErrorOr object::createBinary(MemoryBuffer *Source, - sys::fs::file_magic Type) { + LLVMContext *Context) { OwningPtr scopedSource(Source); - if (Type == sys::fs::file_magic::unknown) - Type = sys::fs::identify_magic(Source->getBuffer()); + sys::fs::file_magic Type = sys::fs::identify_magic(Source->getBuffer()); switch (Type) { case sys::fs::file_magic::archive: @@ -67,11 +66,12 @@ ErrorOr object::createBinary(MemoryBuffer *Source, case sys::fs::file_magic::coff_object: case sys::fs::file_magic::coff_import_library: case sys::fs::file_magic::pecoff_executable: - return ObjectFile::createObjectFile(scopedSource.take(), true, Type); + case sys::fs::file_magic::bitcode: + return ObjectFile::createSymbolicFile(scopedSource.take(), true, Type, + Context); case sys::fs::file_magic::macho_universal_binary: return MachOUniversalBinary::create(scopedSource.take()); case sys::fs::file_magic::unknown: - case sys::fs::file_magic::bitcode: case sys::fs::file_magic::windows_resource: // Unrecognized object file format. return object_error::invalid_file_type; -- cgit v1.2.3