================
@@ -329,9 +332,10 @@ inline void OutputWordWrappedLines(Stream &strm,
       start++;
 
     end = start + max_text_width;
-    if (end > final_end) {
+    if (end > final_end)
       end = final_end;
-    } else {
+
+    if (end != final_end) {
       // If we're not at the end of the text, make sure we break the line on
       // white space.
       while (end > start && text[end] != ' ' && text[end] != '\t' &&
----------------
DavidSpickett wrote:

In the previous version, end could end up being set to final_end, which would 
get into the else clause and try to do text[final_end]. This worked with a 
std::string but not stringref.

I was almost expecting one of the Mac ASAN bots to complain about the tests but 
it didn't. Maybe 1 byte off is fine for a std::string because of the newline? 
Anyway, we can use stringref now.

https://github.com/llvm/llvm-project/pull/181165
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to