summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/IRObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/IRObjectFile.cpp')
-rw-r--r--llvm/lib/Object/IRObjectFile.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp
index 37e7eb80ca5..b3a5668fc20 100644
--- a/llvm/lib/Object/IRObjectFile.cpp
+++ b/llvm/lib/Object/IRObjectFile.cpp
@@ -13,6 +13,7 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Mangler.h"
#include "llvm/IR/Module.h"
#include "llvm/Object/IRObjectFile.h"
#include "llvm/Support/raw_ostream.h"
@@ -27,6 +28,13 @@ IRObjectFile::IRObjectFile(MemoryBuffer *Object, error_code &EC,
return;
M.reset(MOrErr.get());
+
+ // If we have a DataLayout, setup a mangler.
+ const DataLayout *DL = M->getDataLayout();
+ if (!DL)
+ return;
+
+ Mang.reset(new Mangler(DL));
}
static const GlobalValue &getGV(DataRefImpl &Symb) {
@@ -86,9 +94,13 @@ void IRObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
error_code IRObjectFile::printSymbolName(raw_ostream &OS,
DataRefImpl Symb) const {
- // FIXME: This should use the Mangler.
const GlobalValue &GV = getGV(Symb);
- OS << GV.getName();
+
+ if (Mang)
+ Mang->getNameWithPrefix(OS, &GV, false);
+ else
+ OS << GV.getName();
+
return object_error::success;
}
OpenPOWER on IntegriCloud