[PATCH] D16058: [clang-format] Fix comment aligning when there are changes within the comment

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 11 05:05:12 PST 2016


bkramer created this revision.
bkramer added a reviewer: djasper.
bkramer added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

As soon as a comment had whitespace changes inside of the token, we
couldn't identify the whole comment as a trailing comment anymore and
alignment stopped working. Add a new boolean to Change for this special
case and fix trailing comment identification to use it.

Before this fix

int xy;  // a
int z;   //b

became

int xy;  // a
int z;  // b

with this patch we immediately get to:

int xy;  // a
int z;   // b

http://reviews.llvm.org/D16058

Files:
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16058.44466.patch
Type: text/x-patch
Size: 6138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160111/9afdb4b2/attachment-0001.bin>


More information about the cfe-commits mailing list