@@ -101,6 +101,10 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
101
101
// Add a hint if object description was requested, but no description
102
102
// function was implemented.
103
103
auto maybe_add_hint = [&](llvm::StringRef output) {
104
+ static bool note_shown = false ;
105
+ if (note_shown)
106
+ return ;
107
+
104
108
// Identify the default output of object description for Swift and
105
109
// Objective-C
106
110
// "<Name: 0x...>. The regex is:
@@ -110,20 +114,16 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
110
114
// - Followed by 5 or more hex digits.
111
115
// - Followed by ">".
112
116
// - End with zero or more whitespace characters.
113
- const std::regex swift_class_regex (" ^<\\ S+: 0x[[:xdigit:]]{5,}>\\ s*$" );
117
+ static const std::regex class_po_regex (" ^<\\ S+: 0x[[:xdigit:]]{5,}>\\ s*$" );
114
118
115
119
if (GetDebugger ().GetShowDontUsePoHint () && target_ptr &&
116
120
(language == lldb::eLanguageTypeSwift ||
117
121
language == lldb::eLanguageTypeObjC) &&
118
- std::regex_match (output.data (), swift_class_regex)) {
119
-
120
- static bool note_shown = false ;
121
- if (note_shown)
122
- return ;
122
+ std::regex_match (output.data (), class_po_regex)) {
123
123
124
124
result.GetOutputStream ()
125
- << " note: object description requested, but type doesn't implement "
126
- " a custom object description. Consider using \" p\" instead of "
125
+ << " note: object description requested, but type doesn't implement a "
126
+ " custom object description. Consider using \" p\" instead of "
127
127
" \" po\" (this note will only be shown once per debug session).\n " ;
128
128
note_shown = true ;
129
129
}
0 commit comments