History log of /external/clang/lib/Format/WhitespaceManager.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
893ea8d0a6420591d966fa0e7135e510b1523b57 01-Aug-2013 Daniel Jasper <djasper@google.com> clang-format: Make alignment of trailing comments optional ..

.. in order to support WebKit style properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.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/WhitespaceManager.cpp
cbe86cc538b9e1af9f36b8a9c57ea51119306689 01-Jul-2013 Daniel Jasper <djasper@google.com> Don't align "} // namespace" comments.

This is not all bad, but people are often surprised by it.

Before:
namespace {
int SomeVariable = 0; // comment
} // namespace

After:
namespace {
int SomeVariable = 0; // comment
} // namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
22d0e2985d00010ed1d56168985ca34adc75b80a 17-Jun-2013 Alexander Kornienko <alexfh@google.com> Fixes incorrect indentation of line comments after break and re-alignment.

Summary:
Selectively propagate the information about token kind in
WhitespaceManager::replaceWhitespaceInToken.For correct alignment of new
segments of line comments in order to align them correctly. Don't set
BreakBeforeParameter in breakProtrudingToken for line comments, as it introduces
a break after the _next_ parameter. Added tests for related functions.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.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/WhitespaceManager.cpp
b398701e4cbb9a55d90a60e3f4f4bc577446d098 29-May-2013 Manuel Klimek <klimek@google.com> The second step in the token refactoring.

Gets rid of AnnotatedToken, putting everything into FormatToken.
FormatTokens are created once, and only referenced by pointer. This
enables multiple future features, like having tokens shared between
multiple UnwrappedLines (while there's still work to do to fully enable
that).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
dcb3f2aab329c80e97a44312d15299df4dc059be 28-May-2013 Manuel Klimek <klimek@google.com> Make UnwrappedLines and AnnotatedToken contain pointers to FormatToken.

The FormatToken is now not copyable any more.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.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/WhitespaceManager.cpp
854ca794c17679ba4d0e529e8eb8b6b3703d1984 23-May-2013 Manuel Klimek <klimek@google.com> Fix aligning of comments.

Previously we started sequences to align for single line comments when
the previous line had a trailing comment, but the sequence was broken
for other reasons.

Now we re-format:
// a
// b
f(); // c
to:
// a
// b
f(); // c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
23ad339cdb8ee55c5f243bc2573c5f9d6144a647 23-May-2013 Manuel Klimek <klimek@google.com> Fix aligning of comments that are at the start of the line.

Now correctly leaves:
f(); // comment
// comment
g(); // comment
... alone if the middle comment was aligned with g() before formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
ebfb88c32adb40b64a44479708dc6931224ccf96 23-May-2013 Manuel Klimek <klimek@google.com> Stop aligning trailing comments which are aligned with the next line.

Previously we would align:
f(); // comment
// other comment
g();

Even if // other comment was at the start of the line. Now we do not
align trailing comments if they have been already aligned correctly
with the next line.

Thus,
f(); // comment
// other comment
g();
will not be changed, while:
f(); // comment
// other commment
g();
will lead to the two trailing comments being aligned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
ad3094b7d85a4f8eeaf3f60364d5e8796537f061 23-May-2013 Manuel Klimek <klimek@google.com> Use a SourceRange for the whitespace location in FormatToken.

Replaces the use of WhitespaceStart + WhitspaceLength.
This made a bug in the formatter obvous where we would incorrectly
calculate the next column.

FIXME: There's a similar bug left regarding TokenLength. We should
probably also move to have a TokenRange instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
0cd57b52c932c89fae03f0001add4821deaff5e7 22-May-2013 Manuel Klimek <klimek@google.com> Fix uninitialized access error found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.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/WhitespaceManager.cpp
967d9e935d2379ea00726dc51fac5feeca50a4d0 13-May-2013 Manuel Klimek <klimek@google.com> Fix style according to post-commit review comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
7c9a93ec7cea816e94a0674909c312f3d0227864 13-May-2013 Manuel Klimek <klimek@google.com> Implements UseTab for clang-format.

This is required for kernel linux kernel style formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.cpp
2972d049637349bb82f52a27ad3337cf4ab769b4 25-Apr-2013 Daniel Jasper <djasper@google.com> Add option to align escaped newlines left.

This enables formattings like:

#define A \
int aaaa; \
int b; \
int ccc; \
int dddddddddd;

Enabling this for Google/Chromium styles only as I don't know whether it
is desired for Clang/LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Format/WhitespaceManager.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/WhitespaceManager.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/WhitespaceManager.cpp