[Lldb-commits] [compiler-rt] [clang-tools-extra] [flang] [llvm] [lldb] [mlir] [clang] [lld] [libcxx] [DWARFLinker][NFC] Decrease DWARFLinker dependence on DwarfStreamer. (PR #77932)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 17 13:37:17 PST 2024
================
@@ -30,6 +30,20 @@ using namespace llvm;
using namespace dwarf_linker;
using namespace dwarf_linker::classic;
+Expected<std::unique_ptr<DwarfStreamer>> DwarfStreamer::createStreamer(
+ const Triple &TheTriple, DWARFLinkerBase::OutputFileType FileType,
+ raw_pwrite_stream &OutFile, DWARFLinkerBase::TranslatorFuncTy Translator,
+ DWARFLinkerBase::MessageHandlerTy Warning) {
+ DwarfStreamer *Streamer =
+ new DwarfStreamer(FileType, OutFile, Translator, Warning);
+ if (Error Err = Streamer->init(TheTriple, "__DWARF")) {
+ delete Streamer;
+ return std::move(Err);
+ }
+
+ return std::unique_ptr<DwarfStreamer>(Streamer);
----------------
JDevlieghere wrote:
Can we use `make_unique` above and avoid the naked `delete`?
https://github.com/llvm/llvm-project/pull/77932
More information about the lldb-commits
mailing list