#
3867a2d5 |
| 12-Sep-2019 |
Paul Hoad <mydeveloperday@gmail.com> |
[clang-format] Add new style option IndentGotoLabels
Summary: This option determines whether goto labels are indented according to scope. Setting this option to false causes goto labels to be flushe
[clang-format] Add new style option IndentGotoLabels
Summary: This option determines whether goto labels are indented according to scope. Setting this option to false causes goto labels to be flushed to the left. This is mostly copied from [[ http://lists.llvm.org/pipermail/cfe-dev/2015-September/045014.html | this patch ]] submitted by Christian Neukirchen that didn't make its way into trunk.
``` true: false: int f() { vs. int f() { if (foo()) { if (foo()) { label1: label1: bar(); bar(); } } label2: label2: return 1; return 1; } } ```
Reviewers: klimek, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang, #clang-tools-extra
Patch by: tetsuo-cpp
Differential Revision: https://reviews.llvm.org/D67037
llvm-svn: 371719
show more ...
|
#
d40ddb9d |
| 10-Sep-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Apply BAS_AlwaysBreak to C++11 braced lists
See PR18455.
Differential Revision: https://reviews.llvm.org/D67395
llvm-svn: 371571
|
#
37860d52 |
| 18-Aug-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix a bug that joins template closer and =
Also fixes the documentation for SpaceBeforeAssignmentOperators.
See discussions at https://reviews.llvm.org/D66332
Differential Revision:
[clang-format] Fix a bug that joins template closer and =
Also fixes the documentation for SpaceBeforeAssignmentOperators.
See discussions at https://reviews.llvm.org/D66332
Differential Revision: https://reviews.llvm.org/D66384
llvm-svn: 369214
show more ...
|
#
ac674146 |
| 16-Aug-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix the bug that joins template closer and > or >>
Also fixes a buggy test case.
See PR42404
Differential Revision: https://reviews.llvm.org/D66332
llvm-svn: 369157
|
#
10234da7 |
| 11-Aug-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Expand AllowShortBlocksOnASingleLine for WebKit
See PR40840
Differential Revision: https://reviews.llvm.org/D66059
llvm-svn: 368539
|
#
db4ad360 |
| 10-Aug-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Add SpaceInEmptyBlock option for WebKit
See PR40840
Differential Revision: https://reviews.llvm.org/D65925
llvm-svn: 368507
|
#
9ab051bd |
| 08-Aug-2019 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] fix crash involving invalid preprocessor line
Summary: This (invalid) fragment is crashing clang-format: ``` #if 1 int x; #elif int y; #endif ```
The reason being that the parser exp
[clang-format] fix crash involving invalid preprocessor line
Summary: This (invalid) fragment is crashing clang-format: ``` #if 1 int x; #elif int y; #endif ```
The reason being that the parser expects a token after `#elif`, and the subsequent parsing of the next line does not check if `CurrentToken` is null.
Reviewers: gribozavr
Reviewed By: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65940
llvm-svn: 368280
show more ...
|
#
9131e925 |
| 02-Aug-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix a bug that doesn't break braces before unions for Allman Differential Revision: https://reviews.llvm.org/D65631
llvm-svn: 367648
|
#
1361a4c2 |
| 27-Jul-2019 |
Nico Weber <nicolasweber@gmx.de> |
clang-format: Support `if CONSTEXPR` if CONSTEXPR is a macro.
This is like r305666 (which added support for `if constexpr`) except that it allows a macro name after the if.
This is slightly tricky
clang-format: Support `if CONSTEXPR` if CONSTEXPR is a macro.
This is like r305666 (which added support for `if constexpr`) except that it allows a macro name after the if.
This is slightly tricky for two reasons:
1. r305666 didn't add test coverage for all cases where it added a kw_constexpr, so I had to figure out what all the added cases were for. I now added tests for all `if constexpr` bits that didn't have tests. (This took a while, see e.g. https://reviews.llvm.org/D65223)
2. Parsing `if <ident> (` as an if means that `#if defined(` and `#if __has_include(` parse as ifs too. Add some special-case code to prevent this from happening where it's incorrect.
Fixes PR39248.
Differential Revision: https://reviews.llvm.org/D65227
llvm-svn: 367167
show more ...
|
#
c913d1f2 |
| 24-Jul-2019 |
Nico Weber <nicolasweber@gmx.de> |
clang-format: Add another test like r366926
llvm-svn: 366929
|
#
a659de77 |
| 24-Jul-2019 |
Nico Weber <nicolasweber@gmx.de> |
clang-format: Add a test that shows that some code I thought was dead is not dead.
llvm-svn: 366926
|
#
37944130 |
| 23-Jul-2019 |
Nico Weber <nicolasweber@gmx.de> |
clang-format: Fix namespace end comments for namespaces with attributes and macros.
Fixes PR39247.
While here, also make C++20 `namespace A::inline B::inline C` nested inline namespaced definitions
clang-format: Fix namespace end comments for namespaces with attributes and macros.
Fixes PR39247.
While here, also make C++20 `namespace A::inline B::inline C` nested inline namespaced definitions work.
Before: #define DEPRECATE_WOOF [[deprecated("meow")]]
namespace DEPRECATE_WOOF woof { void f() {} } // namespace DEPRECATE_WOOFwoof
namespace [[deprecated("meow")]] woof { void f() {} } // namespace [[deprecated("meow")]]woof
namespace woof::inline bark { void f() {} } // namespace woof::inlinebark
Now: #define DEPRECATE_WOOF [[deprecated("meow")]]
namespace DEPRECATE_WOOF woof { void f() {} } // namespace woof
namespace [[deprecated("meow")]] woof { void f() {} } // namespace woof
namespace woof::inline bark { void f() {} } // namespace woof::inline bark
(In addition to the fixed namespace end comments, also note the correct indent of the namespace contents.)
Differential Revision: https://reviews.llvm.org/D65125
llvm-svn: 366831
show more ...
|
#
d9212ef7 |
| 22-Jul-2019 |
Ben Hamilton <benhamilton@google.com> |
Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.
Summary: Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.
Before:
Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.
Summary: Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.
Before:
``` typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo, FooValueThree}; ```
After:
``` typedef NS_CLOSED_ENUM(NSInteger, Foo) { FooValueOne = 1, FooValueTwo, FooValueThree }; ```
Contributed by heijink.
Reviewers: benhamilton, krasimir
Reviewed By: benhamilton
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65012
llvm-svn: 366719
show more ...
|
#
f4c2d57f |
| 16-Jul-2019 |
Ben Hamilton <benhamilton@google.com> |
[clang-format] Don't detect call to ObjC class method as C++11 attribute specifier
Summary: Previously, clang-format detected something like the following as a C++11 attribute specifier.
@[[NSArr
[clang-format] Don't detect call to ObjC class method as C++11 attribute specifier
Summary: Previously, clang-format detected something like the following as a C++11 attribute specifier.
@[[NSArray class]]
instead of an array with an Objective-C method call inside. In general, when the attribute specifier checking runs, if it sees 2 identifiers in a row, it decides that the square brackets represent an Objective-C method call. However, here, `class` is tokenized as a keyword instead of an identifier, so this check fails.
To fix this, the attribute specifier first checks whether the first square bracket has an "@" before it. If it does, then that square bracket is not the start of a attribute specifier because it is an Objective-C array literal. (The assumption is that @[[.*]] is not valid C/C++.)
Contributed by rkgibson2.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: aaron.ballman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64632
llvm-svn: 366267
show more ...
|
#
04ee232f |
| 02-Jul-2019 |
Sam McCall <sam.mccall@gmail.com> |
clang-format: Add new style option AlignConsecutiveMacros
This option behaves similarly to AlignConsecutiveDeclarations and AlignConsecutiveAssignments, aligning the assignment of C/C++ preprocessor
clang-format: Add new style option AlignConsecutiveMacros
This option behaves similarly to AlignConsecutiveDeclarations and AlignConsecutiveAssignments, aligning the assignment of C/C++ preprocessor macros on consecutive lines.
I've worked in many projects (embedded, mostly) where header files full of large, well-aligned "#define" blocks are a common pattern. We normally avoid using clang-format on these files, since it ruins any existing alignment in said blocks. This style option will align "simple" PP macros (no parameters) and PP macros with parameter lists on consecutive lines.
Related Bugzilla entry (thanks mcuddie): https://llvm.org/bugs/show_bug.cgi?id=20637
Patch by Nick Renieris (VelocityRa)!
Differential Revision: https://reviews.llvm.org/D28462
llvm-svn: 364938
show more ...
|
#
e8a301f8 |
| 06-Jun-2019 |
Francois Ferrand <thetypz@gmail.com> |
clang-format: better handle namespace macros
Summary: Other macros are used to declare namespaces, and should thus be handled similarly. This is the case for crpcut's TESTSUITE macro, or for unittes
clang-format: better handle namespace macros
Summary: Other macros are used to declare namespaces, and should thus be handled similarly. This is the case for crpcut's TESTSUITE macro, or for unittest-cpp's SUITE macro:
TESTSUITE(Foo) { TEST(MyFirstTest) { assert(0); } } // TESTSUITE(Foo)
This patch deals with this cases by introducing a new option to specify lists of namespace macros. Internally, it re-uses the system already in place for foreach and statement macros, to ensure there is no impact on performance.
Reviewers: krasimir, djasper, klimek
Reviewed By: klimek
Subscribers: acoomans, cfe-commits, klimek
Tags: #clang
Differential Revision: https://reviews.llvm.org/D37813
llvm-svn: 362740
show more ...
|
#
c5227a1f |
| 29-May-2019 |
Francois Ferrand <thetypz@gmail.com> |
[clang-format] Allow configuring list of function-like macros that resolve to a type
Summary: Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way simi
[clang-format] Allow configuring list of function-like macros that resolve to a type
Summary: Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way similar to `typeof()`.
This is enough to: - Prevent misinterpreting declarations of pointers to such types as expressions (`STACK_OF(int) * foo` -> `STACK_OF(int) *foo`), - Avoid surprising line breaks in variable/struct field declarations (`STACK_OF(int)\nfoo;` -> `STACK_OF(int) foo;`, see https://bugs.llvm.org/show_bug.cgi?id=30353).
Reviewers: Typz, krasimir, djasper
Reviewed By: Typz
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57184
llvm-svn: 361986
show more ...
|
#
3dcb892d |
| 03-May-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix bug in block comment reflow that joins * and /
Fixes PR41213
Differential Revision: https://reviews.llvm.org/D61276
llvm-svn: 359943
|
#
a0df4d37 |
| 01-May-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix a bug in AlignConsecutiveDeclarations.
Fixes PR37175
Differential Revision: https://reviews.llvm.org/D61222
llvm-svn: 359711
|
#
945890a6 |
| 01-May-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix bug that misses some function-like macro usages
Fixes PR41483
Differential Revision: https://reviews.llvm.org/D61297
llvm-svn: 359687
|
#
108cbbc2 |
| 23-Apr-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix bug in reflow of block comments containing CR/LF
Fix PR36119
Differential Revision: https://reviews.llvm.org/D60996
llvm-svn: 359029
|
#
fb73b79a |
| 18-Apr-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix incorrect formatting of keyword macro definition
See PR39719
Differential Revision: https://reviews.llvm.org/D60853
llvm-svn: 358710
|
#
407dd4d1 |
| 15-Apr-2019 |
Reuben Thomas <reuben.thomas@me.com> |
[clang-format] Fix -Wconversion-null warning in GCC
GCC -Wconversion-null warning appeared after 9a63380260860b657b72f07c4f0e61e382ab934a. There was a similar problem already in the past: http://lis
[clang-format] Fix -Wconversion-null warning in GCC
GCC -Wconversion-null warning appeared after 9a63380260860b657b72f07c4f0e61e382ab934a. There was a similar problem already in the past: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131230/096230.html
Patch committed on behalf of @dendibakh
Differential Revision: https://reviews.llvm.org/D60726
llvm-svn: 358441
show more ...
|
#
bd8a1ce7 |
| 15-Apr-2019 |
Paul Hoad <mydeveloperday@gmail.com> |
[clang-format] [PR41170] Break after return type ignored with certain comments positions
Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41170
The AlwaysBreakAfterReturn type setting can g
[clang-format] [PR41170] Break after return type ignored with certain comments positions
Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41170
The AlwaysBreakAfterReturn type setting can go wrong if the line ends with a comment ``` void foo() /* comment */ ``` or
``` void foo() // comment ```
It will incorrectly see such functions as Declarations and not Definitions
The following code addresses this by looking for function which end with `; <comment>` rather than just `;` or `<comment>`
Reviewers: klimek, djasper, reuk, russellmcc, owenpan, sammccall Reviewed By: owenpan Subscribers: lebedev.ri, cfe-commits, sammccall Tags: #clang Differential Revision: https://reviews.llvm.org/D60363
llvm-svn: 358375
show more ...
|
#
806d5741 |
| 08-Apr-2019 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Add AfterCaseLabel to BraceWrapping
Fixes PR38686
> llvm-svn: 52527
llvm-svn: 357957
|