History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 651 – 675 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# fc51490b 10-Oct-2018 Jonas Devlieghere <jonas@devlieghere.com>

Lift VFS from clang to llvm (NFC)

This patch moves the virtual file system form clang to llvm so it can be
used by more projects.

Concretely the patch:
- Moves VirtualFileSystem.{h|cpp} from clang

Lift VFS from clang to llvm (NFC)

This patch moves the virtual file system form clang to llvm so it can be
used by more projects.

Concretely the patch:
- Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support.
- Moves the corresponding unit test from clang to llvm.
- Moves the vfs namespace from clang::vfs to llvm::vfs.
- Formats the lines affected by this change, mostly this is the result of
the added llvm namespace.

RFC on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html

Differential revision: https://reviews.llvm.org/D52783

llvm-svn: 344140

show more ...


# 6f40e21a 02-Oct-2018 Francois Ferrand <thetypz@gmail.com>

clang-format: better handle statement macros

Summary:
Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new l

clang-format: better handle statement macros

Summary:
Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. This is for example the case with Qt's Q_UNUSED macro:

void foo(int a, int b) {
Q_UNUSED(a)
return b;
}

This patch deals with these cases by introducing a new option to specify list of statement macros. This re-uses the system already in place for foreach macros, to ensure there is no impact on performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: acoomans, mgrang, alexfh, klimek, cfe-commits

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

llvm-svn: 343602

show more ...


# cb5ffbed 28-Sep-2018 Owen Pan <owenpiano@gmail.com>

[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping

It should respond to AfterFunction, not AfterControlStatement.

Fixes PR39067

llvm-svn: 343305


# 9da65a3a 21-Sep-2018 Owen Pan <owenpiano@gmail.com>

[clang-format] Do not merge short case labels if followed by a block.

Do not allow short case labels on a single line if the label is followed by a
left brace.

Fixes PR38926.

llvm-svn: 342708


# 370eff85 17-Sep-2018 Ilya Biryukov <ibiryukov@google.com>

[clang-Format] Fix indentation of member call after block

Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
([]() -> {

[clang-Format] Fix indentation of member call after block

Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
([]() -> {
int b = 32;
return 3;
})
.as();
});
```

after patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
([]() -> {
int b = 32;
return 3;
}).as();
});
```

Patch by Anders Karlsson (ank)!

Reviewers: klimek

Reviewed By: klimek

Subscribers: danilaml, acoomans, klimek, cfe-commits

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

llvm-svn: 342363

show more ...


# 58c3dee3 13-Sep-2018 Owen Pan <owenpiano@gmail.com>

[clang-format] Wrapped block after case label should not be merged into one line

PR38854

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

llvm-svn: 342116


# 6f3778c3 05-Sep-2018 Sam McCall <sam.mccall@gmail.com>

clang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier

This fixes formatting namespaces with preceding 'inline' and 'export' (Modules TS) specifiers.

This change

clang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier

This fixes formatting namespaces with preceding 'inline' and 'export' (Modules TS) specifiers.

This change fixes namespaces not being identified as such with preceding 'inline' or 'export' specifiers.

Motivation: I was experimenting with the Modules TS (-fmodules-ts) and found it would be useful if clang-format would correctly format 'export namespace'. While making the changes, I noticed that similar issues still exist with 'inline namespace', and addressed them as well.

Patch by Marco Elver!

Reviewers: klimek, djasper, owenpan, sammccall

Reviewed By: owenpan, sammccall

Subscribers: owenpan, cfe-commits

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

llvm-svn: 341450

show more ...


# 81b61a82 02-Sep-2018 Jonas Toth <jonas.toth@gmail.com>

Fix Bug 38713: clang-format mishandles a short block after "default:" in a switch statement

Summary:
See https://bugs.llvm.org/show_bug.cgi?id=38713

Patch by Owen Pan!

Reviewers: djasper, klimek,

Fix Bug 38713: clang-format mishandles a short block after "default:" in a switch statement

Summary:
See https://bugs.llvm.org/show_bug.cgi?id=38713

Patch by Owen Pan!

Reviewers: djasper, klimek, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341284

show more ...


# 90d2aa23 24-Aug-2018 Jonas Toth <jonas.toth@gmail.com>

[clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier

Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report

[clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier

Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report here: https://bugs.llvm.org/show_bug.cgi?id=38557

Patch by Owen Pan!

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: JonasToth, cfe-commits

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

llvm-svn: 340624

show more ...


# 4636debc 24-Aug-2018 Jonas Toth <jonas.toth@gmail.com>

[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All

Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.

R

[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All

Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.

Reviewers: djasper, klimek, krasimir, sammccall

Reviewed By: sammccall

Subscribers: hiraditya, JonasToth, cfe-commits

Tags: #clang

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

llvm-svn: 340623

show more ...


# f16a6fa8 01-Aug-2018 Ilya Biryukov <ibiryukov@google.com>

[Format] Fix for bug 35641

Summary:
Bug was caused due to comments at the start of scope. For a code like:
```
int func() { //
int b;
int c;
}
```
the comment at the first line gets IndentAndNes

[Format] Fix for bug 35641

Summary:
Bug was caused due to comments at the start of scope. For a code like:
```
int func() { //
int b;
int c;
}
```
the comment at the first line gets IndentAndNestingLevel (1,1) whereas
the following declarations get only (0,1) which prevents them from insertion
of a new scope. So, I changed the AlignTokenSequence to look at previous
*non-comment* token when deciding whether to introduce a new scope into
stack or not.

Patch by Kadir Cetinkaya!

Reviewers: rsmith, djasper

Reviewed By: djasper

Subscribers: lebedev.ri, cfe-commits, klimek

Tags: #clang

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

llvm-svn: 338578

show more ...


# bfc34065 14-Jun-2018 Hans Wennborg <hans@hanshq.net>

[clang-format] Add SpaceBeforeCpp11BracedList option.

WebKit C++ style for object initialization is as follows:

Foo foo { bar };

Yet using clang-format -style=webkit changes this to:

Foo foo{

[clang-format] Add SpaceBeforeCpp11BracedList option.

WebKit C++ style for object initialization is as follows:

Foo foo { bar };

Yet using clang-format -style=webkit changes this to:

Foo foo{ bar };

As there is no existing combination of rules that will ensure a space
before a braced list in this fashion, this patch adds a new
SpaceBeforeCpp11BracedList rule.

Patch by Ross Kirsling!

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

llvm-svn: 334692

show more ...


# 6bb103f9 11-Jun-2018 Francois Ferrand <thetypz@gmail.com>

clang-format: Introduce BreakInheritanceList option

Summary:
This option replaces the BreakBeforeInheritanceComma option with an
enum, thus introducing a mode where the colon stays on the same line

clang-format: Introduce BreakInheritanceList option

Summary:
This option replaces the BreakBeforeInheritanceComma option with an
enum, thus introducing a mode where the colon stays on the same line as
constructor declaration:

// When it fits on line:
class A : public B, public C {
...
};

// When it does not fit:
class A :
public B,
public C {
...
};

This matches the behavior of the `BreakConstructorInitializers` option,
introduced in https://reviews.llvm.org/D32479.

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: mzeren-vmw, cfe-commits

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

llvm-svn: 334408

show more ...


# ba917bf0 23-May-2018 Krasimir Georgiev <krasimir@google.com>

[clang-format] fix buildbots after r333085

Old gcc versions don't like raw string literals in macros.

llvm-svn: 333092


# 0fb19de0 23-May-2018 Krasimir Georgiev <krasimir@google.com>

[clang-format] Break template declarations followed by comments

Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template decla

[clang-format] Break template declarations followed by comments

Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template declaration to not be split into multiple lines.
These were latent and exposed by r332436.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 333085

show more ...


# 067ec70d 22-May-2018 Krasimir Georgiev <krasimir@google.com>

[clang-format] Add a test case for crash

llvm-svn: 332974


# 58e6fe5b 16-May-2018 Francois Ferrand <thetypz@gmail.com>

clang-format: Allow optimizer to break template declaration.

Summary:
Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
and change `AlwaysBreakTemplateDeclarations` to an enum with

clang-format: Allow optimizer to break template declaration.

Summary:
Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
and change `AlwaysBreakTemplateDeclarations` to an enum with 3 modes:
* `No` for regular, penalty based, wrapping of template declaration
* `MultiLine` for always wrapping before multi-line declarations (e.g.
same as legacy behavior when `AlwaysBreakTemplateDeclarations=false`)
* `Yes` for always wrapping (e.g. same as legacy behavior when
`AlwaysBreakTemplateDeclarations=true`)

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 332436

show more ...


# f92f806a 16-May-2018 Francois Ferrand <thetypz@gmail.com>

clang-format: tweak formatting of variable initialization blocks

Summary:
This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
so that is does not apply after a brace, when Cpp11B

clang-format: tweak formatting of variable initialization blocks

Summary:
This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
so that is does not apply after a brace, when Cpp11BracedListStyle is
false.

This way, variable initialization is wrapped more like an initializer
than like a function call, which is more consistent with user
expectations for this braced list style.

With PenaltyBreakBeforeFirstCallParameter=200, this gives the following
code: (with Cpp11BracedListStyle=false)

Before :

const std::unordered_map<std::string, int> Something::MyHashTable =
{ { "aaaaaaaaaaaaaaaaaaaaa", 0 },
{ "bbbbbbbbbbbbbbbbbbbbb", 1 },
{ "ccccccccccccccccccccc", 2 } };

After :

const std::unordered_set<std::string> Something::MyUnorderedSet = {
{ "aaaaaaaaaaaaaaaaaaaaa", 0 },
{ "bbbbbbbbbbbbbbbbbbbbb", 1 },
{ "ccccccccccccccccccccc", 2 }
};

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 332434

show more ...


# 3538b39e 15-May-2018 Nicola Zaghen <nicola.zaghen@imgtec.com>

[clang] Update uses of DEBUG macro to LLVM_DEBUG.

The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\

[clang] Update uses of DEBUG macro to LLVM_DEBUG.

The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM

Explicitly avoided changing the strings in the clang-format tests.

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

llvm-svn: 332350

show more ...


# 9d92c027 14-May-2018 Eric Liu <ioeric@google.com>

[clang-format] Move #include related style to libToolingCore

Summary: This will be shared by include insertion/deletion library.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: m

[clang-format] Move #include related style to libToolingCore

Summary: This will be shared by include insertion/deletion library.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, klimek, cfe-commits

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

llvm-svn: 332284

show more ...


# 62103052 19-Apr-2018 Krasimir Georgiev <krasimir@google.com>

[clang-format] Don't remove empty lines before namespace endings

Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.

Reviewers: djasper

Revi

[clang-format] Don't remove empty lines before namespace endings

Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 330324

show more ...


# b1a7919e 12-Apr-2018 Ben Hamilton <benhamilton@google.com>

[clang-format] Improve ObjC guessing heuristic by supporting all @keywords

Summary:
This diff improves the Objective-C guessing heuristic by
replacing the hard-coded list of a subset of Objective-C

[clang-format] Improve ObjC guessing heuristic by supporting all @keywords

Summary:
This diff improves the Objective-C guessing heuristic by
replacing the hard-coded list of a subset of Objective-C @keywords
with a general check which supports all @keywords.

I also added a few more Foundation keywords which were missing from
the heuristic.

Test Plan: Unit tests updated. Ran tests with:
% make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329918

show more ...


# 416348ef 12-Apr-2018 Ben Hamilton <benhamilton@google.com>

[clang-format] Always indent wrapped Objective-C selector names

Summary:
Currently, indentation of Objective-C method names which are wrapped
onto the next line due to a long return type is controll

[clang-format] Always indent wrapped Objective-C selector names

Summary:
Currently, indentation of Objective-C method names which are wrapped
onto the next line due to a long return type is controlled by the
style option `IndentWrappedFunctionNames`.

This diff changes the behavior so we always indent wrapped Objective-C
selector names.

NOTE: I partially reverted https://github.com/llvm-mirror/clang/commit/6159c0fbd1876c7f5f984b4830c664cc78f16e2e / rL242484, as it was causing wrapped selectors to be double-indented. Its tests in FormatTestObjC.cpp still pass.

Test Plan: Tests updated. Ran tests with:
% make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, stephanemoore, thakis

Reviewed By: djasper

Subscribers: stephanemoore, klimek, cfe-commits

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

llvm-svn: 329916

show more ...


# d0f3fe55 11-Apr-2018 Manuel Klimek <klimek@google.com>

Fix bugs around handling C++11 attributes.

Previously, we would format:
int a() { ... }
[[unused]] int b() { ... }
as...
int a() {} [[unused] int b() {}
Now we correctly format each on its own

Fix bugs around handling C++11 attributes.

Previously, we would format:
int a() { ... }
[[unused]] int b() { ... }
as...
int a() {} [[unused] int b() {}
Now we correctly format each on its own line.

Similarly, we would detect:
[[unused]] int b() { return 42; }
As a lambda and leave it on a single line, even if that was disallowed
by the format style.

llvm-svn: 329816

show more ...


# c9a918c5 04-Apr-2018 Mark Zeren <mzeren@vmware.com>

[clang-format] In tests, expected code should be format-stable

Summary: Extend various verifyFormat helper functions to check that the
expected text is "stable". This provides some protection agains

[clang-format] In tests, expected code should be format-stable

Summary: Extend various verifyFormat helper functions to check that the
expected text is "stable". This provides some protection against bugs
where formatting results are ocilating between two forms, or continually
change in some other way.

Testing Done:

* Ran unit tests.

* Reproduced a known instability in preprocessor indentation which was
caught by this new check.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 329231

show more ...


1...<<21222324252627282930>>...82