[PATCH] D142699: [AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 20 00:57:27 PDT 2023
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc1888a370ada: [AsmParser] Avoid instantiating LLVMContext if not needed. NFC (authored by yrouban).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142699/new/
https://reviews.llvm.org/D142699
Files:
llvm/lib/AsmParser/Parser.cpp
Index: llvm/lib/AsmParser/Parser.cpp
===================================================================
--- llvm/lib/AsmParser/Parser.cpp
+++ llvm/lib/AsmParser/Parser.cpp
@@ -28,9 +28,9 @@
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(F);
SM.AddNewSourceBuffer(std::move(Buf), SMLoc());
- LLVMContext Context;
+ std::optional<LLVMContext> OptContext;
return LLParser(F.getBuffer(), SM, Err, M, Index,
- M ? M->getContext() : Context, Slots)
+ M ? M->getContext() : OptContext.emplace(), Slots)
.Run(UpgradeDebugInfo, DataLayoutCallback);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142699.506483.patch
Type: text/x-patch
Size: 616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230320/34a0d0b1/attachment.bin>
More information about the llvm-commits
mailing list