History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 751 – 775 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 92b397fb 23-Mar-2017 Nikola Smiljanic <popizdeh@gmail.com>

Fix issues in clang-format's AlignConsecutive modes.

Patch by Ben Harper.

llvm-svn: 298574


# c9c51c4e 16-Mar-2017 Martin Probst <martin@probst.io>

[clang-format] disable adding extra space after MSVC '__super' keyword

clang-format treats MSVC `__super` keyword like all other keywords adding
a single space after. This change disables this behav

[clang-format] disable adding extra space after MSVC '__super' keyword

clang-format treats MSVC `__super` keyword like all other keywords adding
a single space after. This change disables this behavior for `__super`.

Patch originally by jutocz (thanks!).

Differential Revision: https://reviews.llvm.org/D30932

llvm-svn: 297936

show more ...


# 04bbda99 16-Mar-2017 Daniel Jasper <djasper@google.com>

clang-format: Fix bug in wrapping behavior of operators.

Before (even violating the column limit):
auto Diag =
diag()
<< aaaaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa

clang-format: Fix bug in wrapping behavior of operators.

Before (even violating the column limit):
auto Diag =
diag()
<< aaaaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
auto Diag = diag() << aaaaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 297931

show more ...


# 0ef8ee19 10-Mar-2017 Andi-Bogdan Postelnicu <andi@mozilla.com>

[clang-format] Add option to break before inheritance separation operator in class declaration.

Differential Revision: https://reviews.llvm.org/D30487

llvm-svn: 297467


# bc05ebaa 08-Mar-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken

Summary:
This patch makes ContinuationIndenter call breakProtrudingToken only if
NoLineBreak and NoLineBreakIn

[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken

Summary:
This patch makes ContinuationIndenter call breakProtrudingToken only if
NoLineBreak and NoLineBreakInOperand is false.

Previously, clang-format required two runs to converge on the following example with 24 columns:
Note that the second operand shouldn't be splitted according to NoLineBreakInOperand, but the
token breaker doesn't take that into account:
```
func(a, "long long long long", c);
```
After first run:
```
func(a, "long long "
"long long",
c);
```
After second run, where NoLineBreakInOperand is taken into account:
```
func(a,
"long long "
"long long",
c);
```

With the patch, clang-format now obtains in one run:
```
func(a,
"long long long"
"long",
c);
```
which is a better token split overall.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D30575

llvm-svn: 297274

show more ...


# 628dd85b 08-Mar-2017 Daniel Jasper <djasper@google.com>

clang-format: Get slightly better at understanding */&.

Before:
void f() { MACRO(A * const a); }

After:
void f() { MACRO(A *const a); }

llvm-svn: 297268


Revision tags: llvmorg-4.0.0, llvmorg-4.0.0-rc4
# 4743e2d9 07-Mar-2017 Andi-Bogdan Postelnicu <andi@mozilla.com>

[clang-format] Followup of D30646 - unbreak the build

llvm-svn: 297148


# 67329896 07-Mar-2017 Andi-Bogdan Postelnicu <andi@mozilla.com>

[clang-format] Fixed indent issue when adding a comment at the end of a return type in named function declaration.

Differential Revision: https://reviews.llvm.org/D30646

llvm-svn: 297143


Revision tags: llvmorg-4.0.0-rc3
# 9163fe2a 02-Mar-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Use number of unwrapped lines for short namespace

Summary:
This patch makes the namespace comment fixer use the number of unwrapped lines
that a namespace spans to detect it that name

[clang-format] Use number of unwrapped lines for short namespace

Summary:
This patch makes the namespace comment fixer use the number of unwrapped lines
that a namespace spans to detect it that namespace is short, thus not needing
end comments to be added.
This is needed to ensure clang-format is idempotent. Previously, a short namespace
was detected by the original source code lines. This has the effect of requiring two
runs for this example:
```
namespace { class A; }
```
after first run:
```
namespace {
class A;
}
```
after second run:
```
namespace {
class A;
} // namespace
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D30528

llvm-svn: 296736

show more ...


# 32eaa864 01-Mar-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Add a new flag FixNamespaceComments to FormatStyle

Summary:
This patch enables namespace end comments under a new flag FixNamespaceComments,
which is enabled for the LLVM and Google s

[clang-format] Add a new flag FixNamespaceComments to FormatStyle

Summary:
This patch enables namespace end comments under a new flag FixNamespaceComments,
which is enabled for the LLVM and Google styles.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D30405

llvm-svn: 296632

show more ...


# d96ae867 24-Feb-2017 Nico Weber <nicolasweber@gmx.de>

clang-format: Fix many Objective-C formatting regressions from r289428

r289428 added a separate language kind for Objective-C, but kept many
"Language == LK_Cpp" checks untouched. This introduced a

clang-format: Fix many Objective-C formatting regressions from r289428

r289428 added a separate language kind for Objective-C, but kept many
"Language == LK_Cpp" checks untouched. This introduced a "IsCpp()"
method that returns true for both C++ and Objective-C++, and replaces
all comparisons of Language with LK_Cpp with calls to this new method.

Also add a lot more test coverge for formatting things in LK_ObjC mode,
by having FormatTest's verifyFormat() test for LK_ObjC everything that's
being tested for LK_Cpp at the moment.

Fixes PR32060 and many other things.

llvm-svn: 296160

show more ...


# d9b319e3 20-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Prevent weird line-wraps in complex lambda introducers

Before:
aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> ::std::

clang-format: Prevent weird line-wraps in complex lambda introducers

Before:
aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> ::std::
unordered_set<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {
//
});

After:
aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]()
-> ::std::unordered_set<
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {
//
});

llvm-svn: 295659

show more ...


# 23c2b5ae 17-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Don't remove existing spaces between identifier and ::.

This can lead to bad behavior with macros that are used to annotate
functions (e.g. ALWAYS_INLINE).

Before, this:
ALWAYS_INLI

clang-format: Don't remove existing spaces between identifier and ::.

This can lead to bad behavior with macros that are used to annotate
functions (e.g. ALWAYS_INLINE).

Before, this:
ALWAYS_INLINE ::std::string getName() ...

was turned into:
ALWAYS_INLINE::std::string getName() ...

If it turns out that clang-format is failing to clean up a lot of the
existing spaces now, we can add more analyses of the identifier. It
should not currently. Cases where clang-format breaks nested name
specifiers should be fine as clang-format wraps after the "::". Thus, a
line getting longer and then shorter again should lead to the same
original code.

llvm-svn: 295437

show more ...


# bb99a36d 16-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Align block comment decorations

Summary:
This patch implements block comment decoration alignment.

source:
```
/* line 1
* line 2
*/
```

result before:
```
/* line 1
* line 2
*/
```

[clang-format] Align block comment decorations

Summary:
This patch implements block comment decoration alignment.

source:
```
/* line 1
* line 2
*/
```

result before:
```
/* line 1
* line 2
*/
```

result after:
```
/* line 1
* line 2
*/
```

Reviewers: djasper, bkramer, klimek

Reviewed By: klimek

Subscribers: mprobst, cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29943

llvm-svn: 295312

show more ...


# 21088806 10-Feb-2017 Nico Weber <nicolasweber@gmx.de>

clang-format: don't break code using __has_include, PR31908

llvm-svn: 294772


Revision tags: llvmorg-4.0.0-rc2
# fd0dda76 08-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Move comment tests to their own file.

Summary: With a growing suite of comment-related tests, it makes sense to take them out of the main test file. No functional changes.

Reviewers:

[clang-format] Move comment tests to their own file.

Summary: With a growing suite of comment-related tests, it makes sense to take them out of the main test file. No functional changes.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek, mgorny

Differential Revision: https://reviews.llvm.org/D29713

llvm-svn: 294439

show more ...


# f62f958a 08-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Break before a sequence of line comments aligned with the next line.

Summary:
Make the comment alignment respect sections of line comments originally alinged
with the next token. Unti

[clang-format] Break before a sequence of line comments aligned with the next line.

Summary:
Make the comment alignment respect sections of line comments originally alinged
with the next token. Until now the decision how to break a continuous sequence
of line comments into sections was taken without reference to the next token.

source:
```
class A {
public: // comment about public
// comment about a
int a;
}
```

format before:
```
class A {
public: // comment about public
// comment about a
int a;
}
```

format after:
```
class A {
public: // comment about public
// comment about a
int a;
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29626

llvm-svn: 294435

show more ...


# 697a8ec6 07-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Fix bad variable declaration detection.

Before:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});

After:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});

l

clang-format: Fix bad variable declaration detection.

Before:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});

After:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});

llvm-svn: 294358

show more ...


# 2db1b4a1 06-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpenBracket

Fix for the formatting options combination of
BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: Alw

clang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpenBracket

Fix for the formatting options combination of
BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not
handling long templates correctly. This patch allows a break after an
opening left parenthesis, TemplateOpener, or bracket when both options
are enabled.

Patch by Daphne Pfister, thank you!

Fixes llvm.org/PR30304.

llvm-svn: 294179

show more ...


# d105b72d 03-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Re-align broken comment lines where appropriate.

Summary:
The comment aligner was skipping over newly broken comment lines. This patch fixes that.

source:
```
int ab; // line
int a;

[clang-format] Re-align broken comment lines where appropriate.

Summary:
The comment aligner was skipping over newly broken comment lines. This patch fixes that.

source:
```
int ab; // line
int a; // long long
```

format with column limit 15 before:
```
int ab; // line
int a; // long
// long
```

format with column limit 15 after:
```
int ab; // line
int a; // long
// long
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29486

llvm-svn: 293997

show more ...


# 00c5c72d 02-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Don't reflow across comment pragmas.

Summary:
The comment reflower wasn't taking comment pragmas as reflow stoppers. This patch fixes that.

source:
```
// long long long long
// IWYU

[clang-format] Don't reflow across comment pragmas.

Summary:
The comment reflower wasn't taking comment pragmas as reflow stoppers. This patch fixes that.

source:
```
// long long long long
// IWYU pragma:
```
format with column limit = 20 before:
```
// long long long
// long IWYU pragma:
```
format with column limit = 20 after:
```
// long long long
// long
// IWYU pragma:
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29450

llvm-svn: 293898

show more ...


# b6ccd38d 02-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Fix breaking of comment sections in unwrapped lines containing newlines.

Summary:
The breaking of line comment sections was misaligning the case where the first comment line is on an

[clang-format] Fix breaking of comment sections in unwrapped lines containing newlines.

Summary:
The breaking of line comment sections was misaligning the case where the first comment line is on an unwrapped line containing newlines. In this case, the breaking column must be based on the source column of the last token that is preceded by a newline, not on the first token of the unwrapped line.

source:
```
enum A {
a, // line 1
// line 2
};
```
format before:
```
enum A {
a, // line 1
// line 2
};
```
format after:
```
enum A {
a, // line 1
// line 2
};
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29444

llvm-svn: 293891

show more ...


# 28912c09 02-Feb-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Don't reflow lines starting with TODO, FIXME or XXX.

Summary: These lines commonly carry a special meaning.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

[clang-format] Don't reflow lines starting with TODO, FIXME or XXX.

Summary: These lines commonly carry a special meaning.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29396

llvm-svn: 293878

show more ...


# c3aa05c0 02-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Do not use two-argument/operand special case with no alignment

Without alignment, there is no clean separation between the arguments, even if
there are only two.

Before:
aaaaaaaaaaa

clang-format: Do not use two-argument/operand special case with no alignment

Without alignment, there is no clean separation between the arguments, even if
there are only two.

Before:
aaaaaaaaaaaaaa(
aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaa(aaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 293875

show more ...


# b127039c 01-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: Fix incorrect line breaks after forced operator wraps.

Before:
bool x = aaaaa //
||
bbbbb
//
|| cccc;

After:
bool x = aaaaa //

clang-format: Fix incorrect line breaks after forced operator wraps.

Before:
bool x = aaaaa //
||
bbbbb
//
|| cccc;

After:
bool x = aaaaa //
|| bbbbb
//
|| cccc;

llvm-svn: 293839

show more ...


1...<<31323334353637383940>>...82