[Layering] Move DebugInfo.h into the IR library where its implementation
[oota-llvm.git] / lib / Object / ObjectFile.cpp
index 2e6b9e6505a7f418d28ecd5cc9d04c834e4d4573..058bc3436a615d65f9a9a6164514106bd7e1a73e 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/system_error.h"
 
 using namespace llvm;
@@ -25,7 +26,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 {
@@ -80,5 +90,5 @@ ErrorOr<ObjectFile *> ObjectFile::createObjectFile(StringRef ObjectPath) {
   OwningPtr<MemoryBuffer> File;
   if (error_code EC = MemoryBuffer::getFile(ObjectPath, File))
     return EC;
-  return createObjectFile(File.take());
+  return createObjectFile(File.release());
 }