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/ObjectFile.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/ObjectFile.cpp') diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp index 2e6b9e6..923baa5 100644 --- a/llvm/lib/Object/ObjectFile.cpp +++ b/llvm/lib/Object/ObjectFile.cpp @@ -25,7 +25,16 @@ void ObjectFile::anchor() { } ObjectFile::ObjectFile(unsigned int Type, MemoryBuffer *Source, bool BufferOwned) - : Binary(Type, Source, BufferOwned) {} + : SymbolicFile(Type, Source, BufferOwned) {} + +error_code ObjectFile::printSymbolName(raw_ostream &OS, + DataRefImpl Symb) const { + StringRef Name; + if (error_code EC = getSymbolName(Symb, Name)) + return EC; + OS << Name; + return object_error::success; +} error_code ObjectFile::getSymbolAlignment(DataRefImpl DRI, uint32_t &Result) const { -- cgit v1.1