Owen Pan
d005be33ee
[clang-format] Handle C# goto case
constructs ( #113257 )
...
Fixes #113256 .
2024-10-22 18:39:32 -07:00
Emilia Kond
aea60ab94d
[clang-format] Make bitwise and imply requires clause ( #110942 )
...
This patch adjusts the requires clause/expression parser to imply a
requires clause if it is preceded by a bitwise and operator `&`, and
assume it is a reference qualifier. The justification is that bitwise
operations should not be used for requires expressions.
This is a band-aid fix. The real problems lie in the lookahead heuristic
in the same method. It may be worth it to rewrite that whole heuristic
to track more state in the future, instead of just blindly marching
forward across multiple unrelated definitions, since right now, the
definition following the one with the requires clause can influence
whether the heuristic chooses clause or expression.
Fixes https://github.com/llvm/llvm-project/issues/110485
2024-10-22 13:36:28 +03:00
Owen Pan
b5bcdb5cfa
[clang-format] Fix a crash on C# goto case
( #113056 )
...
Fixes #113011 .
2024-10-21 18:50:13 -07:00
Owen Pan
67f576f31d
[clang-format] Handle template opener/closer in braced list ( #112494 )
...
Fixes #112487 .
2024-10-17 19:56:09 -07:00
Iuri Chaer
0fba8381d2
[clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). ( #96804 )
...
* Convert `ReflowComments` from boolean into a new `enum` which can take
on the value `RCS_Never`, `RCS_IndentOnly`, or `RCS_Always`. The first
one is equivalent to the old `false`, the third one is `true`, and the
middle one means that multiline comments should only have their
indentation corrected, which is what Doxygen users will want.
* Preserve backward compatibility while parsing `ReflowComments`.
2024-10-11 19:14:09 -07:00
Owen Pan
e5b05a51b8
[clang-format] Handle template closer followed by braces ( #110971 )
...
Fixes #110968 .
2024-10-04 18:18:03 -07:00
Owen Pan
14e1fef736
[clang-format] Handle template closer followed by empty paretheses ( #110408 )
...
Fixes #109925 .
2024-10-02 19:06:56 -07:00
kadir çetinkaya
04d71ea11b
[Format] Dont treat LBrace after extends/implements as initializer list ( #108524 )
...
This extends the fix in https://github.com/llvm/llvm-project/pull/106242
for other derived class types.
2024-09-16 20:18:39 +02:00
Owen Pan
616a8ce620
[clang-format] Correctly annotate braces in macro definition ( #107352 )
...
Also add a test case for #107096 .
Fixes #106418 .
2024-09-05 18:45:21 -07:00
Owen Pan
3449ed8dec
Revert "[clang-format] Correctly annotate braces in macro definition ( #106662 )"
...
This reverts commit 0fa78b6c7bd43c2498700a98c47a02cf4fd06388 due to
regression.
Fixes #107096 .
2024-09-03 22:54:50 -07:00
Owen Pan
0fa78b6c7b
[clang-format] Correctly annotate braces in macro definition ( #106662 )
...
Fixes #106418 .
2024-09-02 01:40:13 -07:00
Owen Pan
e0f2368cde
[clang-format] Correctly annotate braces in ObjC square brackets ( #106654 )
...
See
https://github.com/llvm/llvm-project/pull/88238#issuecomment-2316954781 .
2024-08-30 19:23:45 -07:00
Owen Pan
7579787e05
[clang-format] Correctly identify token-pasted record names ( #106484 )
...
See
https://github.com/llvm/llvm-project/pull/89706#issuecomment-2315549955 .
2024-08-29 19:14:19 -07:00
Owen Pan
438ad9f2bf
[clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… ( #105923 )
...
…519)"
This reverts commit e00d32afb9d33a1eca48e2b041c9688436706c5b and adds a
test for lambda arrow SplitPenalty.
Fixes #105480 .
2024-08-28 18:23:54 -07:00
Krasimir Georgiev
77d63cfd18
[clang-format] js handle anonymous classes ( #106242 )
...
Addresses a regression in JavaScript when formatting anonymous classes.
---------
Co-authored-by: Owen Pan <owenpiano@gmail.com>
2024-08-28 13:45:17 +02:00
Owen Pan
ee2359968f
[clang-format] Fix annotation of braces enclosing stringification ( #102998 )
...
Fixes #102937 .
2024-08-13 12:39:33 -07:00
Owen Pan
d990cc4568
[clang-format] Correctly handle C# attribute on auto property ( #102921 )
...
Fixes #101487 .
2024-08-12 18:27:32 -07:00
Owen Pan
9fa17fea3c
[clang-format] Handle parenthesized list in RemoveParentheses ( #100852 )
...
Also, reformat clang-format source to remove redundant parentheses
enclosing single list items.
Fixes #100768 .
2024-08-02 01:29:05 -07:00
Nathan Sidwell
18b58d42b2
[clang-format] Rename variable more sensitively ( #100943 )
...
Renaming to `Disallowed`.
2024-08-01 15:29:27 -04:00
Owen Pan
fa00e8bb6a
[clang-format] Correctly annotate l_brace after TypenameMacro ( #96026 )
...
Closes #95418 .
2024-06-19 17:49:35 -07:00
Owen Pan
61571e9046
[clang-format] Handle function try block with ctor-initializer ( #95878 )
...
Fixes #58987 .
Fixes #95679 .
2024-06-18 18:56:33 -07:00
Owen Pan
3c6a1090b2
[clang-format][NFC] Add FormatToken::isAccessSpecifierKeyword() ( #95727 )
2024-06-17 18:45:01 -07:00
Owen Pan
a106131a34
[clang-format] Handle AttributeMacro before access modifiers ( #95634 )
...
Closes #95094 .
2024-06-16 13:50:59 -07:00
Owen Pan
cddb9ce04e
[clang-format] Don't over-indent comment below unbraced body ( #95354 )
...
Fixes #45002 .
2024-06-14 20:49:13 -07:00
Owen Pan
82e19318e6
[clang-format] Fix a bug in annotating lambda l_square ( #95084 )
...
Fixes #95072 .
2024-06-12 00:56:48 -07:00
Owen Pan
798f2019a2
[clang-format] Don't format comments in SkipMacroDefinitionBody ( #94425 )
...
Fixes #94326 .
2024-06-05 17:57:36 -07:00
Owen Pan
13f6797826
[clang-format] Handle AttributeMacros in parseRecord() ( #94189 )
...
Fixes #94184 .
2024-06-03 12:55:10 -07:00
Owen Pan
80303cb287
[clang-format] Handle attributes before lambda return arrow ( #94119 )
...
Fixes #92657 .
2024-06-02 12:26:10 -07:00
Owen Pan
c5fdb5c34e
[clang-format] Insert a space between a keyword and a literal ( #93632 )
...
Fixes #93603 .
2024-05-30 22:13:00 -07:00
Owen Pan
3db1f3110e
[clang-format] Fix a regression in annotating class decl braces ( #93657 )
...
Fixes #93604 .
2024-05-29 21:05:32 -07:00
Owen Pan
a6d97dec89
[clang-format] Correctly annotate C++ alternative operators in C ( #92880 )
...
PR #90161 uncovered a bug that annotates C++ xor as UnaryOperator if
followed by a binary operator. This patch fixes that and all other C++
alternative operator keywords when followed by a binary operator in C.
Fixes #92688 .
2024-05-21 19:16:39 -07:00
Owen Pan
d89f20058b
[clang-format] Fix a bug in formatting goto labels in macros ( #92494 )
...
Fixes #92300 .
2024-05-21 01:35:31 -07:00
Owen Pan
88d351e2e6
[clang-format] Fix a regression in annotating struct braces ( #92352 )
...
Fixes #92350 .
2024-05-16 19:24:35 -07:00
Owen Pan
b11a6607cb
[clang-format][NFC] Reformat with 18.1.5
2024-05-15 21:04:46 -07:00
Owen Pan
364f988d3f
Reland "[clang-format] Fix FormatToken::isSimpleTypeSpecifier() ( #91712 )"
...
Remove FormatToken::isSimpleTypeSpecifier() and call
Token::isSimpleTypeSpecifier(LangOpts) instead.
2024-05-13 21:54:23 -07:00
Owen Pan
1fadb2b0c8
Revert "[clang-format] Fix FormatToken::isSimpleTypeSpecifier() ( #91712 )"
...
This reverts commits e62ce1f8842c, 5cd280433e8e, and de641e289269 due to
buildbot failures.
2024-05-12 23:15:35 -07:00
Owen Pan
e62ce1f884
[clang-format] Fix FormatToken::isSimpleTypeSpecifier() ( #91712 )
...
Remove FormatToken::isSimpleTypeSpecifier() and call
Token::isSimpleTypeSpecifier(LangOpts) instead.
2024-05-10 19:27:02 -07:00
Owen Pan
6ce4c4ca2b
[clang-format][NFC] Drop a redundant clang::format::
2024-05-10 00:05:16 -07:00
Owen Pan
236b3e1aad
[clang-format] Handle Java switch expressions ( #91112 )
...
Also adds AllowShortCaseExpressionOnASingleLine option and
AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements.
Fixes #55903 .
2024-05-06 19:55:55 -07:00
Owen Pan
db0ed55333
[clang-format] Don't remove parentheses of fold expressions ( #91045 )
...
Fixes #90966 .
2024-05-05 21:33:41 -07:00
Emilia Kond
c609043dd0
[clang-format] Don't allow comma in front of structural enum ( #91056 )
...
Assume that a comma in front of `enum` means it is actually a part of an
elaborated type in a template parameter list.
Fixes https://github.com/llvm/llvm-project/issues/47782
2024-05-06 06:44:13 +03:00
Owen Pan
d2af1ea81d
[clang-format][NFC] Minor improvement to parseLabel()
2024-05-02 19:42:01 -07:00
Owen Pan
8e9b1e9aa8
[clang-format] Fix a bug in annotating struct braces ( #90555 )
...
Fixes #60040 .
2024-04-30 20:01:34 -07:00
Owen Pan
4b10ade1a6
[clang-format] Annotate enum braces as BK_Block ( #89871 )
...
Fixes #89759 .
2024-04-24 21:46:45 -07:00
Owen Pan
469c8a0a4e
[clang-format] Correctly annotate list init braces of class types ( #89706 )
...
Fixes #71939 .
2024-04-23 21:27:27 -07:00
Owen Pan
51f1681424
[clang-format] Don't merge a short block for SBS_Never ( #88238 )
...
Also fix unit tests.
Fixes #87484 .
2024-04-10 19:06:29 -07:00
Owen Pan
58323de2e5
[clang-format] Correctly annotate braces in macros ( #87953 )
...
Also fix unit tests and reformat polly.
Fixes #86550 .
2024-04-09 19:59:36 -07:00
Owen Pan
943db678da
[clang-format][NFC] Add getNextNonComment() to FormatTokenSource ( #87868 )
2024-04-07 13:58:49 -07:00
Owen Pan
684f27d37a
[clang-format][NFC] Use is
instead of getType() ==
2024-04-06 01:51:45 -07:00
Owen Pan
770202343e
[clang-format][NFC] Rename kind
to Kind
2024-04-05 22:17:50 -07:00