1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Object] make SourceMgr available to MCContext during inline asm symbols

collection

Fixes PR51210.
This commit is contained in:
Yuanfang Chen 2021-07-25 21:12:28 -07:00
parent b278eba445
commit 0b2bb4e657

View File

@ -99,7 +99,11 @@ initializeRecordStreamer(const Module &M,
if (!MCII)
return;
MCContext MCCtx(TT, MAI.get(), MRI.get(), STI.get());
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(InlineAsm));
SourceMgr SrcMgr;
SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
MCContext MCCtx(TT, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
std::unique_ptr<MCObjectFileInfo> MOFI(
T->createMCObjectFileInfo(MCCtx, /*PIC=*/false));
MOFI->setSDKVersion(M.getSDKVersion());
@ -107,9 +111,6 @@ initializeRecordStreamer(const Module &M,
RecordStreamer Streamer(MCCtx, M);
T->createNullTargetStreamer(Streamer);
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(InlineAsm));
SourceMgr SrcMgr;
SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
std::unique_ptr<MCAsmParser> Parser(
createMCAsmParser(SrcMgr, MCCtx, Streamer, *MAI));