[PATCH] Change design for handling escaped newline and trailing comment layout.

Manuel Klimek klimek at google.com
Tue May 21 13:35:59 PDT 2013


Hi djasper,

Still needs some work, sending out for feedback of the design before I polish it
up.

The main change is in how we handle changes in the WhitespaceManager.
Instead of storing some changes, and applying others directly, we now
consistently store the changes in a uniform format, and do all layouting
in original source order in the end.
This allows us to correctly format unwrapped lines that are split up
by blocks, like:
f({
  g();
})

To support this, handling of protruding tokens had to be switched to an
a-priori annotation, which simplified the code (removing the need for
recursion).

This change also prepares more cleanup; I'm planning to have all alignments
done in the WhitespaceManager, which will also fix the problem of inconsistent
whitespace for indentation between comment alignments and other indents when
using tabs.

http://llvm-reviews.chandlerc.com/D840

Files:
  include/clang/Format/Format.h
  lib/Format/BreakableToken.cpp
  lib/Format/BreakableToken.h
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp
  lib/Format/TokenAnnotator.h
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D840.1.patch
Type: text/x-patch
Size: 39495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130521/3ef8c45c/attachment.bin>


More information about the cfe-commits mailing list