mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Now that it is possible, use the mangler in IRObjectFile.
A really simple patch marks the end of a lot of yak shaving :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user