Skip to content

Commit 5614413

Browse files
authored
Merge pull request #11808 from swiftlang/lldb/diagnostics-lifetime-fix-to-21.x
🍒[lldb][ClangModulesDeclVendor] Fix use-after-free of diagnostics stream
2 parents e28ba6b + cb08727 commit 5614413

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ class StoringDiagnosticConsumer : public clang::DiagnosticConsumer {
6767
IDAndDiagnostic;
6868
std::vector<IDAndDiagnostic> m_diagnostics;
6969
std::unique_ptr<clang::DiagnosticOptions> m_diag_opts;
70+
/// Output string filled by m_os. Will be reused for different diagnostics.
71+
std::string m_output;
72+
/// Output stream of m_diag_printer.
73+
std::unique_ptr<llvm::raw_string_ostream> m_os;
7074
/// The DiagnosticPrinter used for creating the full diagnostic messages
7175
/// that are stored in m_diagnostics.
7276
std::unique_ptr<clang::TextDiagnosticPrinter> m_diag_printer;
73-
/// Output stream of m_diag_printer.
74-
std::unique_ptr<llvm::raw_string_ostream> m_os;
75-
/// Output string filled by m_os. Will be reused for different diagnostics.
76-
std::string m_output;
7777
/// A Progress with explicitly managed lifetime.
7878
std::unique_ptr<Progress> m_current_progress_up;
7979
std::vector<std::string> m_module_build_stack;

0 commit comments

Comments
 (0)