[Lldb-commits] [PATCH] D148823: Make diagnostics API safer to use
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 21 08:22:13 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG737820e6d6e2: Make diagnostics API safer to use (authored by aprantl).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148823/new/
https://reviews.llvm.org/D148823
Files:
lldb/include/lldb/Expression/DiagnosticManager.h
lldb/unittests/Expression/DiagnosticManagerTest.cpp
Index: lldb/unittests/Expression/DiagnosticManagerTest.cpp
===================================================================
--- lldb/unittests/Expression/DiagnosticManagerTest.cpp
+++ lldb/unittests/Expression/DiagnosticManagerTest.cpp
@@ -75,6 +75,9 @@
TEST(DiagnosticManagerTest, GetStringNoDiags) {
DiagnosticManager mgr;
EXPECT_EQ("", mgr.GetString());
+ std::unique_ptr<Diagnostic> empty;
+ mgr.AddDiagnostic(std::move(empty));
+ EXPECT_EQ("", mgr.GetString());
}
TEST(DiagnosticManagerTest, GetStringBasic) {
Index: lldb/include/lldb/Expression/DiagnosticManager.h
===================================================================
--- lldb/include/lldb/Expression/DiagnosticManager.h
+++ lldb/include/lldb/Expression/DiagnosticManager.h
@@ -114,7 +114,8 @@
}
void AddDiagnostic(std::unique_ptr<Diagnostic> diagnostic) {
- m_diagnostics.push_back(std::move(diagnostic));
+ if (diagnostic)
+ m_diagnostics.push_back(std::move(diagnostic));
}
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148823.515744.patch
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230421/0e393982/attachment.bin>
More information about the lldb-commits
mailing list