Skip to content

Commit 93c8135

Browse files
committed
[lldb] Propagate ExpressionErrors from ValueObjectPrinter::GetDescriptionForDisplay
1 parent 3d1c1a5 commit 93c8135

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lldb/source/DataFormatters/ValueObjectPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "lldb/DataFormatters/ValueObjectPrinter.h"
1010

1111
#include "lldb/DataFormatters/DataVisualization.h"
12+
#include "lldb/Expression/DiagnosticManager.h"
1213
#include "lldb/Interpreter/CommandInterpreter.h"
1314
#include "lldb/Target/Language.h"
1415
#include "lldb/Target/Target.h"
@@ -150,6 +151,11 @@ llvm::Expected<std::string> ValueObjectPrinter::GetDescriptionForDisplay() {
150151
if (maybe_str)
151152
return maybe_str;
152153

154+
if (maybe_str.errorIsA<lldb_private::ExpressionError>())
155+
// Propagate expression errors to expose diagnostics to the user.
156+
// Without this early exit, the summary/value may be shown without errors.
157+
return maybe_str;
158+
153159
const char *str = nullptr;
154160
if (!str)
155161
str = valobj.GetSummaryAsCString();

0 commit comments

Comments
 (0)