Skip to content

[lldb] Minor cleanup in StoringDiagnosticConsumer #84263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,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 different 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;
Expand Down Expand Up @@ -142,12 +141,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(
Expand Down