[PATCH] D52745: Adjust the comment section of CreateSource to account for lines longer than 60

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 14:59:00 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL346179: Adjust the comment section of CreateSource to account for lines longer than 60 (authored by lanza, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D52745

Files:
  lldb/trunk/tools/lldb-vscode/JSONUtils.cpp


Index: lldb/trunk/tools/lldb-vscode/JSONUtils.cpp
===================================================================
--- lldb/trunk/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/trunk/tools/lldb-vscode/JSONUtils.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <algorithm>
+
 #include "llvm/Support/FormatAdapters.h"
 
 #include "lldb/API/SBBreakpoint.h"
@@ -541,8 +543,10 @@
       line_strm << llvm::formatv("{0:X+}: <{1}> {2} {3,12} {4}", inst_addr,
                                  inst_offset, llvm::fmt_repeat(' ', spaces),
                                  m, o);
-      const uint32_t comment_row = 60;
-      // If there is a comment append it starting at column 60
+
+      // If there is a comment append it starting at column 60 or after one
+      // space past the last char
+      const uint32_t comment_row = std::max(line_strm.str().size(), (size_t)60);
       if (c && c[0]) {
         if (line.size() < comment_row)
           line_strm.indent(comment_row - line_strm.str().size());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52745.172667.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181105/74cfcf57/attachment.bin>


More information about the llvm-commits mailing list