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
Owen Pan
7c9c38eaa9
[clang-format] Fix a regression in annotating BK_BracedInit ( #87450 )
...
Fixes #86539 .
2024-04-04 17:55:18 -07:00
Owen Pan
b2082a9817
Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"
...
This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See
github.com/llvm/llvm-project/commit/b92d6dd704d7#commitcomment-139992444
We should use a tool like Visual Studio to clean up the headers.
2024-03-19 21:28:22 -07:00
Owen Pan
6f31cf51df
Revert "[clang-format][NFC] Eliminate the IsCpp parameter in all functions ( #84599 )"
...
This reverts c3a1eb6207d8 (and the related commit f3c5278efa3b) which makes
cleanupAroundReplacements() no longer thread-safe.
2024-03-19 18:06:59 -07:00
Owen Pan
b92d6dd704
[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files
2024-03-16 22:24:11 -07:00
Owen Pan
84b5178124
[clang-format] Correctly parse C++11 attributes in enum specifiers ( #85498 )
...
Fixes #85476 .
2024-03-16 13:51:36 -07:00
Owen Pan
c3a1eb6207
Reland [clang-format][NFC] Eliminate the IsCpp parameter in all functions ( #84599 )
...
Initialize IsCpp in LeftRightQualifierAlignmentFixer ctor.
2024-03-14 19:44:40 -07:00
Mehdi Amini
b0d1e32ca2
Revert "[clang-format][NFC] Eliminate the IsCpp parameter in all functions" ( #85353 )
...
Reverts llvm/llvm-project#84599
This broke the presubmit bot.
2024-03-14 19:33:11 -07:00
Owen Pan
0c07102927
[clang-format][NFC] Eliminate the IsCpp parameter in all functions ( #84599 )
2024-03-14 18:56:24 -07:00
Owen Pan
0baef3b18c
[clang-format] Handle common C++ non-keyword types as such ( #83709 )
...
Fixes #83400 .
2024-03-08 19:42:35 -08:00
Owen Pan
051e910b8b
[clang-format][NFC] Replace Style.isCpp() with IsCpp ( #83533 )
2024-03-02 12:57:24 -08:00
r4nt
ddb4450a46
[ClangFormat] Fix indent in child lines within a macro argument. ( #82523 )
...
When reconstructing lines from a macro expansion, make sure that lines
at different levels in the expanded code get indented correctly as part
of the macro argument.
2024-02-23 13:18:00 +01:00
Owen Pan
4af24d4ab7
[clang-format] Don't remove parentheses in macro definitions ( #81444 )
...
Closes #81399 .
2024-02-12 19:20:26 -08:00
Hirofumi Nakamura
6a471611a4
[clang-format] Support of TableGen value annotations. ( #80299 )
...
This implements the annotation of the values in TableGen.
The main changes are,
- parseTableGenValue(), the simplified parser method for the syntax of
values.
- modified consumeToken() to parseTableGenValue in 'if', 'assert' and
after '='.
- modified parseParens() to call parseTableGenValue inside.
- modified parseSquare() to to call parseTableGenValue inside, with
skipping separator tokens.
- modified parseAngle() to call parseTableGenValue inside, with skipping
separator tokens.
2024-02-12 23:27:09 +09:00
XDeme
7e7f118404
[clang-format] Handles Elaborated type specifier for enum in trailing return ( #80085 )
...
Fixes llvm/llvm-project#80062
2024-02-01 14:11:14 -03:00
Emilia Kond
9b68c095d6
[clang-format] Allow decltype in requires clause ( #78847 )
...
If clang-format is not sure whether a `requires` keyword starts a
requires clause or a requires expression, it looks ahead to see if any
token disqualifies it from being a requires clause. Among these tokens
was `decltype`, since it fell through the switch.
This patch allows decltype to exist in a require clause.
I'm not 100% sure this change won't have repercussions, but that just
means we need more test coverage!
Fixes https://github.com/llvm/llvm-project/issues/78645
2024-02-01 08:00:45 +02:00
Hirofumi Nakamura
df4ba00c7b
[clang-format] Support of TableGen statements in unwrapped line parser ( #78846 )
...
Make TableGen's statements to be parsed considering their structure.
- Avoid to parse label
- Avoid class from being parsed as c++'s class
- Support if statement of the form `if <cond> then { ... }`
- Support defset statement of the form `defset <type> <name> {}`
---------
Co-authored-by: Björn Schäpers <github@hazardy.de>
2024-01-22 21:35:01 +09:00
XDeme
a464e05109
[clang-format] Handle templated elaborated type specifier in function… ( #77013 )
...
… return type.
The behavior now is consistent with the non template version.
Enabled and updated old test.
2024-01-20 14:47:58 -08:00
Owen Pan
a7d7da6e45
[clang-format] Add SkipMacroDefinitionBody option ( #78682 )
...
Closes #67991 .
See also: #70338
Co-authored-by: @tomekpaszek
2024-01-20 00:08:23 -08:00