diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 | 
| commit | 3a0822f094b578157263e04114075ad7df81db41 (patch) | |
| tree | bc48361fe2cd1ca5f93ac01b38b183774468fc79 /lib/Object/IRObjectFile.cpp | |
| parent | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff) | |
Notes
Diffstat (limited to 'lib/Object/IRObjectFile.cpp')
| -rw-r--r-- | lib/Object/IRObjectFile.cpp | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp index e89cb8ead36d..e90e08d786f1 100644 --- a/lib/Object/IRObjectFile.cpp +++ b/lib/Object/IRObjectFile.cpp @@ -45,22 +45,22 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)    if (InlineAsm.empty())      return; -  StringRef Triple = M->getTargetTriple(); +  Triple TT(M->getTargetTriple());    std::string Err; -  const Target *T = TargetRegistry::lookupTarget(Triple, Err); +  const Target *T = TargetRegistry::lookupTarget(TT.str(), Err);    if (!T)      return; -  std::unique_ptr<MCRegisterInfo> MRI(T->createMCRegInfo(Triple)); +  std::unique_ptr<MCRegisterInfo> MRI(T->createMCRegInfo(TT.str()));    if (!MRI)      return; -  std::unique_ptr<MCAsmInfo> MAI(T->createMCAsmInfo(*MRI, Triple)); +  std::unique_ptr<MCAsmInfo> MAI(T->createMCAsmInfo(*MRI, TT.str()));    if (!MAI)      return;    std::unique_ptr<MCSubtargetInfo> STI( -      T->createMCSubtargetInfo(Triple, "", "")); +      T->createMCSubtargetInfo(TT.str(), "", ""));    if (!STI)      return; @@ -70,7 +70,7 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)    MCObjectFileInfo MOFI;    MCContext MCCtx(MAI.get(), MRI.get(), &MOFI); -  MOFI.InitMCObjectFileInfo(Triple, Reloc::Default, CodeModel::Default, MCCtx); +  MOFI.InitMCObjectFileInfo(TT, Reloc::Default, CodeModel::Default, MCCtx);    std::unique_ptr<RecordStreamer> Streamer(new RecordStreamer(MCCtx));    T->createNullTargetStreamer(*Streamer); @@ -198,6 +198,9 @@ std::error_code IRObjectFile::printSymbolName(raw_ostream &OS,      return std::error_code();    } +  if (GV->hasDLLImportStorageClass()) +    OS << "__imp_"; +    if (Mang)      Mang->getNameWithPrefix(OS, GV, false);    else @@ -301,12 +304,12 @@ llvm::object::IRObjectFile::create(MemoryBufferRef Object,    std::unique_ptr<MemoryBuffer> Buff(        MemoryBuffer::getMemBuffer(BCOrErr.get(), false)); -  ErrorOr<Module *> MOrErr = +  ErrorOr<std::unique_ptr<Module>> MOrErr =        getLazyBitcodeModule(std::move(Buff), Context, nullptr,                             /*ShouldLazyLoadMetadata*/ true);    if (std::error_code EC = MOrErr.getError())      return EC; -  std::unique_ptr<Module> M(MOrErr.get()); +  std::unique_ptr<Module> &M = MOrErr.get();    return llvm::make_unique<IRObjectFile>(Object, std::move(M));  } | 
