[cfe-dev] [cfe-commits] [PATCH] pretty display of unprintable source and correct caret/range/fixup alignment

Craig Topper craig.topper at gmail.com
Mon Apr 16 20:14:27 PDT 2012


byteToColumn and columnToByte bodies probably shouldn't be buried inside
SourceColumnMap. The indentation is confusing because of it.

Believe the general still is to keep the operator at the end of the
previous line when splitting lines

+  assert(CaretStart!=(unsigned)-1 && CaretEnd!=(unsigned)-1
+         && SourceStart!=(unsigned)-1 && SourceEnd!=(unsigned)-1);

+    std::pair<SmallString<16>,bool> res
+        = printableTextForNextCharacter(line, &i, DiagOpts.TabStop);


This is a nit, but the 'else' isn't needed since the 'if' ends in a return.

+      return std::make_pair(expandedCP, false);
+    } else {
+      // If next character is valid UTF-8, and printable
+      return std::make_pair(SmallString<16>(original_begin, cp_end), true);
+    }

~Craig

On Mon, Apr 16, 2012 at 8:12 PM, Seth Cantrell <seth.cantrell at gmail.com>wrote:

> Oh, and the Windows build finished and looks fine.
>
>
> On Apr 16, 2012, at 11:10 PM, Seth Cantrell wrote:
>
> > It was a line length problem, but one of the other changes eliminated it.
> >
> > On Apr 16, 2012, at 11:05 PM, Craig Topper wrote:
> >
> >> This style is kind of hard to read as it makes arguments look like
> local variables at first glance. If it's a line length problem, putting
> "static void" on a separate line is probably a better choice so that the
> argument can still line up with the the parenthese.
> >>
> >> +static void selectInterestingSourceRegion(
> >> +  std::string &SourceLine,
> >> +  std::string &CaretLine,
> >> +  std::string &FixItInsertionLine,
> >> +  unsigned Columns,
> >> +  const SourceColumnMap &map) {
> >>
> >> --
> >> ~Craig
> > <0003-fix-parameter-formatting.patch>
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120416/c61a0f66/attachment.html>


More information about the cfe-dev mailing list