#
9e27f383 |
| 18-Oct-2020 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
[clang-format] Add a SpaceAroundPointerQualifiers style option
Some projects (e.g. FreeBSD) align pointers to the right but expect a space between the '*' and any pointer qualifiers such as const. T
[clang-format] Add a SpaceAroundPointerQualifiers style option
Some projects (e.g. FreeBSD) align pointers to the right but expect a space between the '*' and any pointer qualifiers such as const. To handle these cases this patch adds a new config option SpaceAroundPointerQualifiers that can be used to configure whether spaces need to be added before/after pointer qualifiers.
PointerAlignment = Right SpaceAroundPointerQualifiers = Default/After: void *const *x = NULL; SpaceAroundPointerQualifiers = Before/Both void * const *x = NULL;
PointerAlignment = Left SpaceAroundPointerQualifiers = Default/Before: void* const* x = NULL; SpaceAroundPointerQualifiers = After/Both void* const * x = NULL;
PointerAlignment = Middle SpaceAroundPointerQualifiers = Default/Before/After/Both: void * const * x = NULL;
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D88227
show more ...
|
#
e7b4feea |
| 14-Oct-2020 |
Ben Hamilton <benhamilton@google.com> |
[Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros
The argument passed to the preprocessor macros `NS_SWIFT_NAME(x)` and `CF_SWIFT_NAME(x)` is stringified before pass
[Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros
The argument passed to the preprocessor macros `NS_SWIFT_NAME(x)` and `CF_SWIFT_NAME(x)` is stringified before passing to `__attribute__((swift_name("x")))`.
ClangFormat didn't know about this stringification, so its custom parser tried to parse the argument(s) passed to the macro as if they were normal function arguments.
That means ClangFormat currently incorrectly inserts whitespace between `NS_SWIFT_NAME` arguments with colons and dots, so:
``` extern UIWindow *MainWindow(void) NS_SWIFT_NAME(getter:MyHelper.mainWindow()); ```
becomes:
``` extern UIWindow *MainWindow(void) NS_SWIFT_NAME(getter : MyHelper.mainWindow()); ```
which clang treats as a parser error:
``` error: 'swift_name' attribute has invalid identifier for context name [-Werror,-Wswift-name-attribute] ```
Thankfully, D82620 recently added the ability to treat specific macros as "whitespace sensitive", meaning their arguments are implicitly treated as strings (so whitespace is not added anywhere inside).
This diff adds `NS_SWIFT_NAME` and `CF_SWIFT_NAME` to `WhitespaceSensitiveMacros` so their arguments are implicitly treated as whitespace-sensitive.
Test Plan: New tests added. Ran tests with: % ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D89425
show more ...
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2 |
|
#
f64903fd |
| 18-Aug-2020 |
Joachim Meyer <joachim@joameyer.de> |
Add -Wno-error=unknown flag to clang-format.
Currently newer clang-format options cannot be included in .clang-format files, if not all users can be forced to use an updated version. This patch trie
Add -Wno-error=unknown flag to clang-format.
Currently newer clang-format options cannot be included in .clang-format files, if not all users can be forced to use an updated version. This patch tries to solve this by adding an option to clang-format, enabling to ignore unknown (newer) options.
Differential Revision: https://reviews.llvm.org/D86137
show more ...
|
#
2e7add81 |
| 18-Sep-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Add a option for the position of Java static import
Some Java style guides and IDEs group Java static imports after non-static imports. This patch allows clang-format to control th
[clang-format] Add a option for the position of Java static import
Some Java style guides and IDEs group Java static imports after non-static imports. This patch allows clang-format to control the location of static imports.
Patch by: @bc-lee
Reviewed By: MyDeveloperDay, JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D87201
show more ...
|
#
e7bd058c |
| 07-Sep-2020 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
[clang-format] Allow configuring list of macros that map to attributes
This adds a `AttributeMacros` configuration option that causes certain identifiers to be parsed like a __attribute__((foo)) ann
[clang-format] Allow configuring list of macros that map to attributes
This adds a `AttributeMacros` configuration option that causes certain identifiers to be parsed like a __attribute__((foo)) annotation. This is motivated by our CHERI C/C++ fork which adds a __capability qualifier for pointer/reference. Without this change clang-format parses many type declarations as multiplications/bitwise-and instead. I initially considered adding "__capability" as a new clang-format keyword, but having a list of macros that should be treated as attributes is more flexible since it can be used e.g. for static analyzer annotations or other language extensions.
Example: std::vector<foo * __capability> -> std::vector<foo *__capability>
Depends on D86775 (to apply cleanly)
Reviewed By: MyDeveloperDay, jrtc27
Differential Revision: https://reviews.llvm.org/D86782
show more ...
|
#
4f103695 |
| 28-Aug-2020 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
[clang-format] Parse restrict as a pointer qualifier
Before: void f() { MACRO(A * restrict a); } After: void f() { MACRO(A *restrict a); }
Also check that the __restrict and __restrict__ aliases a
[clang-format] Parse restrict as a pointer qualifier
Before: void f() { MACRO(A * restrict a); } After: void f() { MACRO(A *restrict a); }
Also check that the __restrict and __restrict__ aliases are handled.
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86710
show more ...
|
Revision tags: llvmorg-11.0.0-rc1 |
|
#
f5acd11d |
| 27-Jul-2020 |
Bruno Ricci <riccibrun@gmail.com> |
[clang-format][NFC] Be more careful about the layout of FormatToken.
The underlying ABI forces FormatToken to have a lot of padding.
Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After
[clang-format][NFC] Be more careful about the layout of FormatToken.
The underlying ABI forces FormatToken to have a lot of padding.
Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After this patch `sizeof(FormatToken) == 232`.
No functional changes.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D84306
show more ...
|
#
52ab7aa0 |
| 18-Jul-2020 |
Anders Waldenborg <anders@0x63.nu> |
[clang-format] Add BitFieldColonSpacing option
This new option allows controlling if there should be spaces around the ':' in a bitfield declaration.
BitFieldColonSpacing accepts four different val
[clang-format] Add BitFieldColonSpacing option
This new option allows controlling if there should be spaces around the ':' in a bitfield declaration.
BitFieldColonSpacing accepts four different values:
// "Both" - default unsigned bitfield : 5 unsigned bf2 : 5 // AlignConsecutiveBitFields=true
// "None" unsigned bitfield:5 unsigned bf2 :5
// "Before" unsigned bitfield :5 unsigned bf2 :5
// "After" unsigned bitfield: 5 unsigned bf2 : 5
Differential Revision: https://reviews.llvm.org/D84090
show more ...
|
Revision tags: llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2 |
|
#
0c332a77 |
| 26-Jun-2020 |
Jake Merdich <Jake.Merdich@amd.com> |
[clang-format] Preserve whitespace in selected macros
Summary: https://bugs.llvm.org/show_bug.cgi?id=46383
When the c preprocessor stringizes tokens, the generated string literals are affected by t
[clang-format] Preserve whitespace in selected macros
Summary: https://bugs.llvm.org/show_bug.cgi?id=46383
When the c preprocessor stringizes tokens, the generated string literals are affected by the whitespace. This means clang-format can affect codegen silently, adding spaces and newlines to strings. Practically speaking, the vast majority of cases will be harmless, only affecting single identifiers or debug macros.
In the interest of doing no harm in other cases though, this introduces a blacklist option 'WhitespaceSensitiveMacros', which contains a list of names of function-like macros whose contents should not be touched by clang-format, period. Clang-format can't automatically detect these without a real compile context, so users will have to specify it explicitly (it still beats clang-format off'ing at every invocation).
Defaults include "STRINGIZE", "PP_STRINGIZE", and "BOOST_PP_STRINGIZE".
Subscribers: kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82620
show more ...
|
#
f1ef237d |
| 16-Jun-2020 |
Sam McCall <sam.mccall@gmail.com> |
[Format] Add more proto enclosing function names
|
#
9520bf14 |
| 04-Jun-2020 |
Jonathan Coe <jbcoe@google.com> |
[clang-format] Update GoogleStyle for C# code to match Google's internal C# style guide
Summary: Google's C# style guide is at https://google.github.io/styleguide/csharp-style.html
Reviewers: krasi
[clang-format] Update GoogleStyle for C# code to match Google's internal C# style guide
Summary: Google's C# style guide is at https://google.github.io/styleguide/csharp-style.html
Reviewers: krasimir, MyDeveloperDay, sammccall
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits, klimek
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D79715
show more ...
|
#
6ef45b04 |
| 20-May-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Added new option IndentExternBlock
Reviewers: MyDeveloperDay, krasimir, klimek, mitchell-stellar, Abpostelnicu
Patch By: MarcusJohnson91
Reviewed By: MyDeveloperDay, Abpostelnicu
S
[clang-format] Added new option IndentExternBlock
Reviewers: MyDeveloperDay, krasimir, klimek, mitchell-stellar, Abpostelnicu
Patch By: MarcusJohnson91
Reviewed By: MyDeveloperDay, Abpostelnicu
Subscribers: sylvestre.ledru, Abpostelnicu, cfe-commits
Tags: #clang, #clang-format, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D75791
show more ...
|
#
807ab2cd |
| 20-May-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] [PR42164] Add Option to Break before While
Summary: Its currently not possible to recreate the GNU style using the `BreakBeforeBraces: Custom` style due to a lack of missing `BeforeWh
[clang-format] [PR42164] Add Option to Break before While
Summary: Its currently not possible to recreate the GNU style using the `BreakBeforeBraces: Custom` style due to a lack of missing `BeforeWhile` in the `BraceWrappingFlags`
The following request was raised to add `BeforeWhile` in a `do..while` context like `BeforeElse` and `BeforeCatch` to give greater control over the positioning of the `while`
https://bugs.llvm.org/show_bug.cgi?id=42164
Reviewers: krasimir, mitchell-stellar, sammccall
Reviewed By: krasimir
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79325
show more ...
|
#
b99bf0e0 |
| 20-May-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format][PR45816] Add AlignConsecutiveBitFields
Summary: The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.
[clang-format][PR45816] Add AlignConsecutiveBitFields
Summary: The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.llvm.org/show_bug.cgi?id=45816 and my efforts on tooling support for AMDVLK, respectively.
This option aligns adjacent bitfield separators across lines, in a manner similar to AlignConsecutiveAssignments and friends.
Example: ``` struct RawFloat { uint32_t sign : 1; uint32_t exponent : 8; uint32_t mantissa : 23; }; ``` would become ``` struct RawFloat { uint32_t sign : 1; uint32_t exponent : 8; uint32_t mantissa : 23; }; ```
This also handles c++2a style bitfield-initializers with AlignConsecutiveAssignments. ``` struct RawFloat { uint32_t sign : 1 = 0; uint32_t exponent : 8 = 127; uint32_t mantissa : 23 = 0; }; // defaults to 1.0f ```
Things this change does not do: - Align multiple comma-chained bitfield variables. None of the other AlignConsecutive* options seem to implement that either. - Detect bitfields that have a width specified with something other than a numeric literal (ie, `int a : SOME_MACRO;`). That'd be fairly difficult to parse and is rare.
Patch By: JakeMerdichAMD
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D80176
show more ...
|
Revision tags: llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1, llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1, llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2 |
|
#
0ee04e6e |
| 22-May-2017 |
Francois Ferrand <thetypz@gmail.com> |
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it coul
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual operands (e.g. after an assignment).
With this patch, the operands are actually aligned, and the operator gets aligned with the equal sign:
int aaaaa = bbbbbb + cccccc;
This not happen in tests, to avoid 'breaking' the indentation:
if (aaaaa && bbbbb) return;
Reviewers: krasimir, djasper, klimek, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: MyDeveloperDay, acoomans, cfe-commits, klimek
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D32478
show more ...
|
#
53cc90f7 |
| 27-Aug-2019 |
Manuel Klimek <klimek@google.com> |
Make FormatToken::Type private.
This enables us to intercept changes to the token type via setType(), which is a precondition for being able to use multi-pass formatting for macro arguments.
Differ
Make FormatToken::Type private.
This enables us to intercept changes to the token type via setType(), which is a precondition for being able to use multi-pass formatting for macro arguments.
Differential Revision: https://reviews.llvm.org/D67405
show more ...
|
#
305a4abf |
| 07-May-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] [PR45126] Help text is missing all available formats
Summary: https://bugs.llvm.org/show_bug.cgi?id=45126
GNU and Microsoft styles are built in supported styles but are not displayed
[clang-format] [PR45126] Help text is missing all available formats
Summary: https://bugs.llvm.org/show_bug.cgi?id=45126
GNU and Microsoft styles are built in supported styles but are not displayed in the help text
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79372
show more ...
|
#
f21c7045 |
| 26-Apr-2020 |
Daan De Meyer <daan.j.demeyer@gmail.com> |
clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens
Summary: systemd recently added a clang-format file. One issue I encountered in using clang-format on systemd is th
clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens
Summary: systemd recently added a clang-format file. One issue I encountered in using clang-format on systemd is that systemd does not add a space before the parens of their foreach macros but clang-format always adds a space. This does not seem to be configurable in clang-format. This revision adds the ControlStatementsExceptForEachMacros option to SpaceBeforeParens which puts a space before all control statement parens except ForEach macros. This drastically reduces the amount of changes when running clang-format on systemd's source code.
Reviewers: MyDeveloperDay, krasimir, mitchell-stellar
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D78869
show more ...
|
#
292058a5 |
| 30-Apr-2020 |
Aaron Smith <aaron.smith@microsoft.com> |
[clang-format] Fix Microsoft style for enums
Summary: Before this change enums were formatted incorrectly for the Microsoft style.
[C++ Example]
enum { one, two } three, four;
[clang-format] Fix Microsoft style for enums
Summary: Before this change enums were formatted incorrectly for the Microsoft style.
[C++ Example]
enum { one, two } three, four;
[Incorrectly Formatted]
enum { one, two } three, four;
[Correct Format with Patch]
enum { one, two } three, four;
Reviewers: jbcoe, MyDeveloperDay, rnk
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D78982
show more ...
|
#
57332269 |
| 30-Apr-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Correct the AfterControlStatement configuration option output style
Summary: Due to the order in which the enum cases were defined the old options which were retained for backwards co
[clang-format] Correct the AfterControlStatement configuration option output style
Summary: Due to the order in which the enum cases were defined the old options which were retained for backwards compatibility were being preferred over the new options when printing with the --dump-config option.
Reviewers: MyDeveloperDay
Reviewed By: MyDeveloperDay
Patch By: duncan-llvm
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79020
show more ...
|
#
20df6038 |
| 29-Apr-2020 |
Richard Smith <richard@metafoo.co.uk> |
Make -fno-char8_t disable the char8_t keyword, even in C++20.
This fixes a regression introduced in r354736, and makes our behavior compatible with that of Clang 8 and GCC.
|
#
47ef09e4 |
| 23-Apr-2020 |
Haojian Wu <hokein.wu@gmail.com> |
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTe
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTest.ConfigurableUseOfTab) is failing in the buildbot:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/31811/steps/ninja%20check%201/logs/stdio
show more ...
|
#
3d61b112 |
| 22-May-2017 |
Francois Ferrand <thetypz@gmail.com> |
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual o
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual operands (e.g. after an assignment).
With this patch, there is an option to actually align the operands, so that the operator gets right-aligned with the equal sign or return operator:
int aaaaa = bbbbbb + cccccc; return aaaaaaa && bbbbbbb;
This not happen in parentheses, to avoid 'breaking' the indentation:
if (aaaaa && bbbbb) return;
Reviewers: krasimir, djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D32478
show more ...
|
#
6a308943 |
| 21-Apr-2020 |
Aaron Ballman <aaron@aaronballman.com> |
C++2a -> C++20 in some identifiers; NFC.
|
#
1647ff6e |
| 13-Apr-2020 |
Georgii Rymar <grimar@accesssoftek.com> |
[ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers.
It can be used to avoid passing the begin and end of a range. This makes the code shorter and it is consistent with another wrappe
[ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers.
It can be used to avoid passing the begin and end of a range. This makes the code shorter and it is consistent with another wrappers we already have.
Differential revision: https://reviews.llvm.org/D78016
show more ...
|