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
This commit is contained in:
Rafael Espindola
2014-02-21 20:10:59 +00:00
parent 3825c08a60
commit 91f86b7e1c
21 changed files with 676 additions and 281 deletions

View File

@ -182,12 +182,13 @@ error_code Archive::Child::getMemoryBuffer(OwningPtr<MemoryBuffer> &Result,
return error_code::success();
}
error_code Archive::Child::getAsBinary(OwningPtr<Binary> &Result) const {
error_code Archive::Child::getAsBinary(OwningPtr<Binary> &Result,
LLVMContext *Context) const {
OwningPtr<Binary> ret;
OwningPtr<MemoryBuffer> Buff;
if (error_code ec = getMemoryBuffer(Buff))
return ec;
ErrorOr<Binary *> BinaryOrErr = createBinary(Buff.take());
ErrorOr<Binary *> BinaryOrErr = createBinary(Buff.take(), Context);
if (error_code EC = BinaryOrErr.getError())
return EC;
Result.reset(BinaryOrErr.get());