@@ -104,6 +104,10 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
104104 // Add a hint if object description was requested, but no description
105105 // function was implemented.
106106 auto maybe_add_hint = [&](llvm::StringRef output) {
107+ static bool note_shown = false ;
108+ if (note_shown)
109+ return ;
110+
107111 // Identify the default output of object description for Swift and
108112 // Objective-C
109113 // "<Name: 0x...>. The regex is:
@@ -113,21 +117,18 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
113117 // - Followed by 5 or more hex digits.
114118 // - Followed by ">".
115119 // - End with zero or more whitespace characters.
116- const std::regex swift_class_regex (" ^<\\ S+: 0x[[:xdigit:]]{5,}>\\ s*$" );
120+ static const std::regex swift_class_regex (
121+ " ^<\\ S+: 0x[[:xdigit:]]{5,}>\\ s*$" );
117122
118123 if (GetDebugger ().GetShowDontUsePoHint () && target_ptr &&
119124 (language == lldb::eLanguageTypeSwift ||
120125 language == lldb::eLanguageTypeObjC) &&
121126 std::regex_match (output.data (), swift_class_regex)) {
122127
123- static bool note_shown = false ;
124- if (note_shown)
125- return ;
126-
127- result.GetOutputStream ()
128- << " note: object description requested, but type doesn't implement "
129- " a custom object description. Consider using \" p\" instead of "
130- " \" po\" (this note will only be shown once per debug session).\n " ;
128+ result.AppendNote (
129+ " object description requested, but type doesn't implement "
130+ " a custom object description. Consider using \" p\" instead of "
131+ " \" po\" (this note will only be shown once per debug session).\n " );
131132 note_shown = true ;
132133 }
133134 };
@@ -181,8 +182,8 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
181182 StringRef flags;
182183 if (args.HasArgs ())
183184 flags = args.GetArgString ();
184- result.AppendMessageWithFormatv ( " note: ran `frame variable {0}{1}`" ,
185- flags, expr);
185+ result.AppendNoteWithFormatv ( " ran `frame variable {0}{1}`" , flags ,
186+ expr);
186187 }
187188
188189 dump_val_object (*valobj_sp);
@@ -281,8 +282,7 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
281282 StringRef flags;
282283 if (args.HasArgs ())
283284 flags = args.GetArgStringWithDelimiter ();
284- result.AppendMessageWithFormatv (" note: ran `expression {0}{1}`" , flags,
285- expr);
285+ result.AppendNoteWithFormatv (" ran `expression {0}{1}`" , flags, expr);
286286 }
287287
288288 if (valobj_sp->GetError ().GetError () != UserExpression::kNoResult )
0 commit comments