From 60174f118de85cbcad51deb11c650f22c9be2235 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 21 Jun 2015 13:59:01 +0000 Subject: Vendor import of llvm trunk r240225: https://llvm.org/svn/llvm-project/llvm/trunk@240225 --- lib/Object/IRObjectFile.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/Object/IRObjectFile.cpp') diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp index e89cb8e..e90e08d 100644 --- a/lib/Object/IRObjectFile.cpp +++ b/lib/Object/IRObjectFile.cpp @@ -45,22 +45,22 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr 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 MRI(T->createMCRegInfo(Triple)); + std::unique_ptr MRI(T->createMCRegInfo(TT.str())); if (!MRI) return; - std::unique_ptr MAI(T->createMCAsmInfo(*MRI, Triple)); + std::unique_ptr MAI(T->createMCAsmInfo(*MRI, TT.str())); if (!MAI) return; std::unique_ptr STI( - T->createMCSubtargetInfo(Triple, "", "")); + T->createMCSubtargetInfo(TT.str(), "", "")); if (!STI) return; @@ -70,7 +70,7 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr 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 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 Buff( MemoryBuffer::getMemBuffer(BCOrErr.get(), false)); - ErrorOr MOrErr = + ErrorOr> MOrErr = getLazyBitcodeModule(std::move(Buff), Context, nullptr, /*ShouldLazyLoadMetadata*/ true); if (std::error_code EC = MOrErr.getError()) return EC; - std::unique_ptr M(MOrErr.get()); + std::unique_ptr &M = MOrErr.get(); return llvm::make_unique(Object, std::move(M)); } -- cgit v1.1