diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-21 20:10:59 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-21 20:10:59 +0000 |
commit | 91f86b7e1c07e73667537e6b849f9977caeeed3d (patch) | |
tree | eec10058b9d06564ce0339282b7b202d1f76c17d /lib/Object/Binary.cpp | |
parent | 3825c08a609de48d5752e4d74e3c03cca651f894 (diff) | |
download | llvm-91f86b7e1c07e73667537e6b849f9977caeeed3d.tar.gz llvm-91f86b7e1c07e73667537e6b849f9977caeeed3d.tar.bz2 llvm-91f86b7e1c07e73667537e6b849f9977caeeed3d.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/Binary.cpp')
-rw-r--r-- | lib/Object/Binary.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp index 63898d277f..c7f868fcdd 100644 --- a/lib/Object/Binary.cpp +++ b/lib/Object/Binary.cpp @@ -42,10 +42,9 @@ StringRef Binary::getFileName() const { } ErrorOr<Binary *> object::createBinary(MemoryBuffer *Source, - sys::fs::file_magic Type) { + LLVMContext *Context) { OwningPtr<MemoryBuffer> 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<Binary *> 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; |