[Lldb-commits] [PATCH] D146412: [NFC] Fix potential for use-after-free in DumpModuleInfoAction

Tom Honermann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 29 09:08:33 PDT 2023


tahonermann added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:2182-2183
 
-    clang::DumpModuleInfoAction dump_module_info;
-    dump_module_info.OutputStream = &result.GetOutputStream().AsRawOstream();
+    std::shared_ptr<llvm::raw_ostream> Out(
+        &result.GetOutputStream().AsRawOstream(), [](llvm::raw_ostream *) {});
+    clang::DumpModuleInfoAction dump_module_info(Out);
----------------
Use of `std::shared_ptr` with a deleter that doesn't do anything is unusual; I think this deserves a comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146412/new/

https://reviews.llvm.org/D146412



More information about the lldb-commits mailing list