[Lldb-commits] [lldb] 6515930 - [lldb] Minor cleanup in StoringDiagnosticConsumer (#84263)

via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 7 10:13:18 PST 2024


Author: Dave Lee
Date: 2024-03-07T10:13:14-08:00
New Revision: 6515930b0cc4aa2e11e75728ef6cbeecbe5caec2

URL: https://github.com/llvm/llvm-project/commit/6515930b0cc4aa2e11e75728ef6cbeecbe5caec2
DIFF: https://github.com/llvm/llvm-project/commit/6515930b0cc4aa2e11e75728ef6cbeecbe5caec2.diff

LOG: [lldb] Minor cleanup in StoringDiagnosticConsumer (#84263)

Removes an unused field. Retypes unshared smart pointers to `unique_ptr`.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 2d778e410b0e73..024fc75a5dd590 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -67,12 +67,11 @@ class StoringDiagnosticConsumer : public clang::DiagnosticConsumer {
   std::vector<IDAndDiagnostic> m_diagnostics;
   /// The DiagnosticPrinter used for creating the full diagnostic messages
   /// that are stored in m_diagnostics.
-  std::shared_ptr<clang::TextDiagnosticPrinter> m_diag_printer;
+  std::unique_ptr<clang::TextDiagnosticPrinter> m_diag_printer;
   /// Output stream of m_diag_printer.
-  std::shared_ptr<llvm::raw_string_ostream> m_os;
+  std::unique_ptr<llvm::raw_string_ostream> m_os;
   /// Output string filled by m_os. Will be reused for 
diff erent diagnostics.
   std::string m_output;
-  Log *m_log;
   /// A Progress with explicitly managed lifetime.
   std::unique_ptr<Progress> m_current_progress_up;
   std::vector<std::string> m_module_build_stack;
@@ -134,12 +133,10 @@ class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  m_log = GetLog(LLDBLog::Expressions);
-
-  clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
-  m_os = std::make_shared<llvm::raw_string_ostream>(m_output);
+  auto *options = new clang::DiagnosticOptions();
+  m_os = std::make_unique<llvm::raw_string_ostream>(m_output);
   m_diag_printer =
-      std::make_shared<clang::TextDiagnosticPrinter>(*m_os, m_options);
+      std::make_unique<clang::TextDiagnosticPrinter>(*m_os, options);
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(


        


More information about the lldb-commits mailing list