[Lldb-commits] [lldb] [lldb] Add a simplified syntax for underlying command options (NFC) (PR #155694)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 28 02:22:28 PDT 2025


================
@@ -23,6 +23,31 @@ using namespace llvm;
 using namespace lldb_private;
 
 namespace {
+/// Parses curly braces and replaces them with ANSI underline formatting.
+inline std::string underline(llvm::StringRef Str) {
+  llvm::StringRef OpeningHead, OpeningTail, ClosingHead, ClosingTail;
+  std::string Result;
+  llvm::raw_string_ostream Stream(Result);
+  while (!Str.empty()) {
+    // Find the opening brace.
+    std::tie(OpeningHead, OpeningTail) = Str.split("${");
+    Stream << OpeningHead;
+
+    // No opening brace: we're done.
+    if (OpeningHead == Str && OpeningTail.empty())
----------------
DavidSpickett wrote:

I get that if we seek to the end of the string, there's no `${`. The second condition seems like it should be an assert though?

If the first part is true shouldn't the second part always be true?

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


More information about the lldb-commits mailing list