History log of /external/clang/lib/Format/BreakableToken.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Format/BreakableToken.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Format/BreakableToken.cpp
a7462b8ce22a3f754bf51eeeb01adafc42b32cea 12-Nov-2013 Alexander Kornienko <alexfh@google.com> Remove extra whitespace instead of breaking the line in comments when possible.

Summary: Solves the problem described in http://llvm.org/PR17756

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D2131

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
74b7363bcfc502dec34092af434da787cf9d5b9f 30-Oct-2013 Daniel Jasper <djasper@google.com> clang-format: fix for \r\r\n produced in multiline block comments

Patch by Christopher Olsen. Thank you!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
3d9ffcf3aa0ed84fa297e3c461bb84e48221aa2d 27-Sep-2013 Alexander Kornienko <alexfh@google.com> Implemented tab usage only for indentation (http://llvm.org/PR17363)

Summary:
Changed UseTab to be a enum with three options: Never, Always,
ForIndentation (true/false are still supported when reading .clang-format).
IndentLevel should currently be propagated correctly for all tokens, except for
block comments. Please take a look at the general idea before I start dealing
with block comments.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1770

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
2c2f729d10cb10324bf2e7871867f7bbc19ad358 16-Sep-2013 Alexander Kornienko <alexfh@google.com> When in pre-c++11 mode, treat _T("xxx") as a single string literal, repeat the _T() part around each fragment. This addresses http://llvm.org/PR17122

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek, rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D1640

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
83a7dcdf5fce1bdf74ce985419d77a41a51abfa2 10-Sep-2013 Alexander Kornienko <alexfh@google.com> Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.

Summary:
This fixes various issues with mixed tabs and spaces handling, e.g.
when realigning block comments.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1608

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
0b62cc30c9aa462184de0435dc083d944a41d67f 05-Sep-2013 Alexander Kornienko <alexfh@google.com> Handle zero-width and double-width characters in string literals and comments.

Summary:
Count column width instead of the number of code points. This also
includes correct handling of tabs inside string literals and comments (with an
exception of multiline string literals/comments, where tabs are present before
the first escaped newline).

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D1601

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
2519d56d558eb40a23ede9bbba154514d0ec7ee2 08-Aug-2013 Arnold Schwaighofer <aschwaighofer@apple.com> Revert r187935 "Support for double width characters."

It broke a public build bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
712b7473f9de7cc1979c3754d03e15a2f492349e 08-Aug-2013 Alexander Kornienko <alexfh@google.com> Support for double width characters.

Summary: Only works for UTF-8-encoded files.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D1311

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187935 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
3aa29df37b140f9c6786b6863a0cac195071b598 15-Jul-2013 Craig Topper <craig.topper@gmail.com> Add 'static' and 'const' qualifiers to some arrays of strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
2a409b62126d8f0b8f5749d5ed435ad2b394b526 08-Jul-2013 Daniel Jasper <djasper@google.com> Reformat clang-format's source files after r185822 and others.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
1659dedac63858de50ee60175a88c42ff974e61b 08-Jul-2013 Alexander Kornienko <alexfh@google.com> Fix for corner cases in code handling leading "* " decorations in block comments

Summary:
Fixes problems that lead to incorrect formatting of these and similar snippets:
/*
**
*/

/*
**/

/*
* */

/*
*test
*/

Clang-format used to think that all the cases above use "* " decoration, and
failed to calculate insertion position properly. It also used to remove leading
"* " in the last line.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1113

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185818 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
b8f716464b9f7eaae62aa9d646e7eca7f566990f 01-Jul-2013 Craig Topper <craig.topper@gmail.com> Use static for helper functions instead of an anonymous namespace per coding standards.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
cf1e216a2aa8ba3cc50cf046f5d057948b234a1f 01-Jul-2013 Craig Topper <craig.topper@gmail.com> Make string pointer const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
8afa39b271d94969891dba014e0fc545b4873479 20-Jun-2013 Alexander Kornienko <alexfh@google.com> Use the same set of whitespace characters for all operations in BreakableToken.

Summary:
Fixes a problem where \t,\v or \f could lead to a crash when placed as
a first character in a line comment. The cause is that rtrim and ltrim handle
these characters, but our code didn't, so some invariants could be broken.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1013

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
f2b2c7da1f3bfed9b0bb194ff00d6e1e43d68d5c 19-Jun-2013 Alexander Kornienko <alexfh@google.com> Split long strings on word boundaries.

Summary: Split strings at word boundaries, when there are no spaces and slashes.

Reviewers: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1003

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
16a0ec60507a4eec275a5c3a86d4501b1b7b817b 14-Jun-2013 Alexander Kornienko <alexfh@google.com> Don't remove backslashes from block comments.

Summary:
Don't remove backslashes from block comments. Previously this
/* \ \ \ \ \ \
*/
would be turned to this:
/*
*/
which spoils some kinds of ASCII-art, people use in their comments. The behavior
was related to handling escaped newlines in block comments inside preprocessor
directives. This patch makes handling it in a more civilized way.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D979

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
2b2faa53ecd32e823c55430d0889c11ea91b582c 11-Jun-2013 Alexander Kornienko <alexfh@google.com> Insert a space at the start of a line comment in case it starts with an alphanumeric character.

Summary:
"//Test" becomes "// Test". This change is aimed to improve code
readability and conformance to certain coding styles. If a comment starts with a
non-alphanumeric character, the space isn't added, e.g. "//-*-c++-*-" stays
unchanged.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D949

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
2785b9aabcb2c3fd6f7dd8b63d3cd3d4b9bca284 07-Jun-2013 Alexander Kornienko <alexfh@google.com> 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
/external/clang/lib/Format/BreakableToken.cpp
00895106f9ed602af67984ec4d225a0cdc8c12af 05-Jun-2013 Alexander Kornienko <alexfh@google.com> UTF-8 support for clang-format.

Summary:
Detect if the file is valid UTF-8, and if this is the case, count code
points instead of just using number of bytes in all (hopefully) places, where
number of columns is needed. In particular, use the new
FormatToken.CodePointCount instead of TokenLength where appropriate.
Changed BreakableToken implementations to respect utf-8 character boundaries
when in utf-8 mode.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, rsmith, gribozavr

Differential Revision: http://llvm-reviews.chandlerc.com/D918

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183312 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
cb4b40b86e284151d6ca14181f949655a9ceccd8 30-May-2013 Daniel Jasper <djasper@google.com> More fixes for clang-format's multiline comment breaking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
920927016ed13bff83af016701b7d118a3dfed3b 30-May-2013 Daniel Jasper <djasper@google.com> Fix another clang-format crasher related to multi-line comments.

This fixes:
/*
*
* something long going over the column limit.
*/

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
b6dba337ba87c2f47a402ecccf4089ab86bbe70c 30-May-2013 Manuel Klimek <klimek@google.com> Add asserts to guard against regressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
e2c482f3720261dea180400816d4572d1986f423 30-May-2013 Daniel Jasper <djasper@google.com> Fix crasher when formatting certain block comments.

Smallest reproduction:
/*
**
*/

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182913 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
be9ed776e57fe606b5826a0d37a5a2dbfb927e63 30-May-2013 Manuel Klimek <klimek@google.com> Fixes error when splitting block comments.

When trying to fall back to search from the end onwards, we
would still find leading whitespace if the leading whitespace
went on after the end of the line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
d63312b1484a4642225c97e1dd013fe520b2b9a4 28-May-2013 Manuel Klimek <klimek@google.com> Disable tab expansion when counting the columns in block comments.

To fully support this, we also need to expand tabs in the text before
the block comment. This patch breaks indentation when there was a
non-standard mixture of spaces and tabs used for indentation, but
fixes a regression in the simple case:
{
/*
* Comment.
*/
int i;
}
Is now formatted correctly, if there were tabs used for indentation
before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
c5cc4bf2699b0542f352738f84eee373cfcf670f 28-May-2013 Manuel Klimek <klimek@google.com> Fixes indentation of empty lines in block comments.

Block comment indentation of empty lines regressed, as we did not
have a test for it.
/* Comment with...
*
* empty line. */
is now formatted correctly again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
de008c0f3bf66103185fc9f7f49995fa431451a6 27-May-2013 Manuel Klimek <klimek@google.com> Major refactoring of BreakableToken.

Unify handling of whitespace when breaking protruding tokens with other
whitespace replacements.

As a side effect, the BreakableToken structure changed significantly:
- have a common base class for single-line breakable tokens, as they are
much more similar
- revamp handling of multi-line comments; we now calculate the
information about lines in multi-line comments similar to normal
tokens, and always issue replacements

As a result, we were able to get rid of special casing of trailing
whitespace deletion for comments in the whitespace manager and the
BreakableToken and fixed bugs related to tab handling and escaped
newlines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
e573c3f7fc40e813559ab4ff1e7eec4f66f1a50f 22-May-2013 Manuel Klimek <klimek@google.com> Makes whitespace management more consistent.

Instead of selectively storing some changes and directly generating
replacements for others, we now notify the WhitespaceManager of the
whitespace before every token (and optionally with more changes inside
tokens).

Then, we run over all whitespace in the very end in original source
order, where we have all information available to correctly align
comments and escaped newlines.

The future direction is to pull more of the comment alignment
implementation that is now in the BreakableToken into the
WhitespaceManager.

This fixes a bug when aligning comments or escaped newlines in unwrapped
lines that are handled out of order:
#define A \
f({ \
g(); \
});
... now gets correctly layouted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
919398bb40d5d643f38b6595f5e8eac641e89d50 17-Apr-2013 Alexander Kornienko <alexfh@google.com> Unified token breaking logic: support for line comments.

Summary:
Added BreakableLineComment, moved common code from
BreakableBlockComment to newly added BreakableComment. As a side-effect of the
rewrite, found another problem with escaped newlines and had to change
code which removes trailing whitespace from line comments not to break after
this patch.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D682

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp
70ce7881fc30a39b795b2873f008e7eca72ba669 15-Apr-2013 Alexander Kornienko <alexfh@google.com> Unified token breaking logic for strings and block comments.

Summary:
Both strings and block comments are broken into lines in
breakProtrudingToken. Logic specific for strings or block comments is abstracted
in implementations of the BreakToken interface. Among other goodness, this
change fixes placement of backslashes after a block comment inside a
preprocessor directive (see removed FIXMEs in unit tests).

The code is far from being polished, and some parts of it will be changed for
line comments support.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D665

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/BreakableToken.cpp