Skip to content

Commit c1888a3

Browse files
author
Yevgeny Rouban
committed
[AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Differential Revision: https://reviews.llvm.org/D142699
1 parent 32bd1f5 commit c1888a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/AsmParser/Parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ static bool parseAssemblyInto(MemoryBufferRef F, Module *M,
2828
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(F);
2929
SM.AddNewSourceBuffer(std::move(Buf), SMLoc());
3030

31-
LLVMContext Context;
31+
std::optional<LLVMContext> OptContext;
3232
return LLParser(F.getBuffer(), SM, Err, M, Index,
33-
M ? M->getContext() : Context, Slots)
33+
M ? M->getContext() : OptContext.emplace(), Slots)
3434
.Run(UpgradeDebugInfo, DataLayoutCallback);
3535
}
3636

0 commit comments

Comments
 (0)