From: Yevgeny Rouban Date: Mon, 20 Mar 2023 07:54:10 +0000 (+0700) Subject: [AsmParser] Avoid instantiating LLVMContext if not needed. NFC X-Git-Tag: upstream/17.0.6~14307 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1888a370ada6e76d51cdb9c6eeefa2588a475eb;p=platform%2Fupstream%2Fllvm.git [AsmParser] Avoid instantiating LLVMContext if not needed. NFC Differential Revision: https://reviews.llvm.org/D142699 --- diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp index 035eea8..eded892 100644 --- a/llvm/lib/AsmParser/Parser.cpp +++ b/llvm/lib/AsmParser/Parser.cpp @@ -28,9 +28,9 @@ static bool parseAssemblyInto(MemoryBufferRef F, Module *M, std::unique_ptr Buf = MemoryBuffer::getMemBuffer(F); SM.AddNewSourceBuffer(std::move(Buf), SMLoc()); - LLVMContext Context; + std::optional OptContext; return LLParser(F.getBuffer(), SM, Err, M, Index, - M ? M->getContext() : Context, Slots) + M ? M->getContext() : OptContext.emplace(), Slots) .Run(UpgradeDebugInfo, DataLayoutCallback); }