History log of /llvm-project/clang/lib/Format/WhitespaceManager.cpp (Results 151 – 175 of 183)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 7198b0c7 23-Nov-2014 Daniel Jasper <djasper@google.com>

clang-format: Refactoring.

Provide more overloads to simplify testing the type of a token. No
functional changes intended.

llvm-svn: 222638


Revision tags: llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1, llvmorg-3.4.2, llvmorg-3.4.2-rc1
# b05a81de 09-May-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix bug introduced by r208392.

Also run clang-format over clang-format's files.

llvm-svn: 208409


# 66935020 27-Apr-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix bug when aligning trailing /**/-comments in macros.

Previously this could lead to a column limit violation with the
required escaped newlines.

llvm-svn: 207351


Revision tags: llvmorg-3.4.1, llvmorg-3.4.1-rc2
# 67d9c8c8 17-Apr-2014 Alexander Kornienko <alexfh@google.com>

Fix alignment of trailing block comments.

Summary:
This patch ensures that the lines of the block comments retain relative
column offsets. In order to do this WhitespaceManager::Changes representing

Fix alignment of trailing block comments.

Summary:
This patch ensures that the lines of the block comments retain relative
column offsets. In order to do this WhitespaceManager::Changes representing
continuation of block comments keep a pointer on the change representing the
whitespace change before the block comment, and a relative column offset to this
change, so that the correct column can be reconstructed at the end of alignment
process.

Fixes http://llvm.org/PR19325

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D3408

llvm-svn: 206472

show more ...


Revision tags: llvmorg-3.4.1-rc1
# 03b1bc7a 28-Mar-2014 Daniel Jasper <djasper@google.com>

clang-format: Fix aligning of comments and escaped newlines in macros.

Before:
#define A \
int i; /*a*/ \
int jjj; /*b*/

After:
#define A \
int i; /*a*/ \
int jj

clang-format: Fix aligning of comments and escaped newlines in macros.

Before:
#define A \
int i; /*a*/ \
int jjj; /*b*/

After:
#define A \
int i; /*a*/ \
int jjj; /*b*/

llvm-svn: 205011

show more ...


Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1
# 0e93cdb0 08-Nov-2013 Daniel Jasper <djasper@google.com>

clang-format: Improve clang-format's detection about comment binding.

Before, existing code in the form of:

int a; // this is a.
// This is
// b.
int b;

Got turned into:

int a; // this

clang-format: Improve clang-format's detection about comment binding.

Before, existing code in the form of:

int a; // this is a.
// This is
// b.
int b;

Got turned into:

int a; // this is a.
// This is
// b.
int b;

llvm-svn: 194294

show more ...


# 71814b44 11-Oct-2013 Manuel Klimek <klimek@google.com>

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifde

Support formatting of preprocessor branches.

We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifdef A
MyType<Some> >
#else
Type1, Type2>
#endif
param2,
#endif
param3) {
f();
}

llvm-svn: 192503

show more ...


# 45dc1b2f 27-Sep-2013 Alexander Kornienko <alexfh@google.com>

Added a comment and another test for the UT_ForIndentation option

llvm-svn: 191530


# 3c3d09c8 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 readi

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

llvm-svn: 191527

show more ...


# db4c21f9 27-Sep-2013 Alexander Kornienko <alexfh@google.com>

Correctly indent with tabs when whitespace starts from the column not divisible by TabWidth.

Summary:
The width of the first inserted tab character depends on the initial
column, so we need to handl

Correctly indent with tabs when whitespace starts from the column not divisible by TabWidth.

Summary:
The width of the first inserted tab character depends on the initial
column, so we need to handle the first tab in a special manner.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 191497

show more ...


# 81e3294e 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: cf

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

llvm-svn: 190804

show more ...


# 9e649af0 11-Sep-2013 Alexander Kornienko <alexfh@google.com>

Support for CR LF newlines.

Summary:
reformat() tries to determine the newline style used in the input
(either LF or CR LF), and uses it for the output. Maybe not every single case is
supported, but

Support for CR LF newlines.

Summary:
reformat() tries to determine the newline style used in the input
(either LF or CR LF), and uses it for the output. Maybe not every single case is
supported, but at least the bug described in http://llvm.org/PR17182 should be
resolved.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190519

show more ...


# ebb43caa 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 st

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

llvm-svn: 190052

show more ...


# a49393f5 28-Aug-2013 Daniel Jasper <djasper@google.com>

clang-format: Fix infinite loop in macro special case.

If escaped newlines are aligned right
(FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained
too many characters to fit into the

clang-format: Fix infinite loop in macro special case.

If escaped newlines are aligned right
(FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained
too many characters to fit into the column limit, this would result in
a (virtually) endless loop creating a negative number of spaces.

Instead, allow the escaped newlines to be pushed past the column limit
in this case.

This fixes llvm.org/PR16515.

llvm-svn: 189459

show more ...


# 552f4a7e 31-Jul-2013 Daniel Jasper <djasper@google.com>

clang-format: Make alignment of trailing comments optional ..

.. in order to support WebKit style properly.

llvm-svn: 187549


Revision tags: llvmorg-3.3.1-rc1
# 3ac9b9e2 08-Jul-2013 Daniel Jasper <djasper@google.com>

Reformat clang-format's source files after r185822 and others.

llvm-svn: 185823


# 251b3c9e 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:
nam

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

llvm-svn: 185327

show more ...


# 4d26b6ef 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

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

llvm-svn: 184076

show more ...


# 555efc36 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

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

llvm-svn: 183750

show more ...


Revision tags: llvmorg-3.3.0, llvmorg-3.3.0-rc3
# 6e6310ec 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 futur

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).

llvm-svn: 182859

show more ...


# 591ab5a8 28-May-2013 Manuel Klimek <klimek@google.com>

Make UnwrappedLines and AnnotatedToken contain pointers to FormatToken.

The FormatToken is now not copyable any more.

llvm-svn: 182772


# 9043c74f 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 signific

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.

llvm-svn: 182738

show more ...


# 75ef31f6 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-f

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

llvm-svn: 182608

show more ...


# b27375fc 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.

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.

llvm-svn: 182605

show more ...


# c573080d 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. No

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.

llvm-svn: 182577

show more ...


12345678