]> granicus.if.org Git - clang/commit
Fixed calculation of penalty when breaking tokens.
authorAlexander Kornienko <alexfh@google.com>
Fri, 7 Jun 2013 16:02:52 +0000 (16:02 +0000)
committerAlexander Kornienko <alexfh@google.com>
Fri, 7 Jun 2013 16:02:52 +0000 (16:02 +0000)
commit2785b9aabcb2c3fd6f7dd8b63d3cd3d4b9bca284
tree5a4d9870c49f9359e9acf9b601a0847bc88b5f25
parent7e6e515fc74ecb6d98689a93b5569763c53c107a
Fixed calculation of penalty when breaking tokens.

Summary:
Introduced two new style parameters: PenaltyBreakComment and
PenaltyBreakString. Add penalty for each character of a breakable token beyond
the column limit (this relates mainly to comments, as they are broken only on
whitespace). Tuned PenaltyBreakComment to prefer comment breaking over breaking
inside most binary expressions.
Fixed a bug that prevented *, & and && from being considered TT_BinaryOperator
in the presense of adjacent comments.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D933

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183530 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Format/Format.h
lib/Format/BreakableToken.cpp
lib/Format/BreakableToken.h
lib/Format/Format.cpp
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp