[Lldb-commits] [lldb] Convert ValueObject::Dump() to return llvm::Error() (NFCish) (PR #95857)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 18 14:05:57 PDT 2024


================
@@ -299,7 +299,9 @@ bool Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const {
             .SetHideRootType(true)
             .SetHideRootName(true)
             .SetHideName(true);
-        m_old_value_sp->Dump(strm, options);
+        if (llvm::Error error = m_old_value_sp->Dump(strm, options))
+          strm << "error: " << toString(std::move(error));
----------------
JDevlieghere wrote:

Would this be worth color highlighting? 

```
llvm::WithColor(strm.AsRawOstream(), llvm::HighlightColor::Error,
                         llvm::ColorMode::Enable) << "error :";
strm <<  toString(std::move(error));
```

This should do the correct thing based on whether the stream has colors enabled. It's the same thing we do in `CommandReturnObject.cpp`. This applies to all the places where we write "error:" to the stream. 

https://github.com/llvm/llvm-project/pull/95857


More information about the lldb-commits mailing list