[PATCH] D142699: [AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 02:58:38 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26d954bd4004: [AsmParser] Avoid instantiating LLVMContext if not needed. Try 2. (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/include/llvm/IR/LLVMContext.h
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);
}
Index: llvm/include/llvm/IR/LLVMContext.h
===================================================================
--- llvm/include/llvm/IR/LLVMContext.h
+++ llvm/include/llvm/IR/LLVMContext.h
@@ -68,7 +68,7 @@
public:
LLVMContextImpl *const pImpl;
LLVMContext();
- LLVMContext(LLVMContext &) = delete;
+ LLVMContext(const LLVMContext &) = delete;
LLVMContext &operator=(const LLVMContext &) = delete;
~LLVMContext();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142699.507665.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230323/4d88ef1d/attachment.bin>
More information about the llvm-commits
mailing list