summaryrefslogtreecommitdiff
path: root/clang/lib/Format/UnwrappedLineParser.cpp
AgeCommit message (Collapse)Author
2025-11-13[clang-format] Recognize Verilog DPI export and import (#165595)sstwcw
The directives should not change the indentation level. Previously the program erroneously added an indentation level when it saw the `function` keyword.
2025-11-05[clang-format] Fix brace wrapping for Java records (#164711)Hannes Braun
The brace wrapping for Java records should now behave similar to classes. Before, opening braces for Java records were always placed in the same line as the record definition.
2025-10-17[clang] Replace LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]] (NFC) (#163914)Kazu Hirata
This patch replaces LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]], introduced as part of C++17.
2025-10-12[clang-format] Fix formatting of `requires` expressions in braced ↵Ruoyu Zhong
initializers (#163005) `UnwrappedLineParser::parseBracedList` had no explicit handling for the `requires` keyword, so it would just call `nextToken()` instead of properly parsing the `requires` expression. This fix adds a case for `tok::kw_requires` in `parseBracedList`, calling `parseRequiresExpression` to handle it correctly, matching the existing behavior in `parseParens`. Fixes https://github.com/llvm/llvm-project/issues/162984.
2025-10-02[clang-format][NFC] Introduce isNoneOf (#161021)Björn Schäpers
And apply throughout the code base.
2025-09-27[clang-format] Fix bugs in annotating arrows and square brackets (#160973)owenca
Fixes #160518
2025-09-14[clang-format] Add IndentPPDirectives Leave option (#139750)Gedare Bloom
Allow an option to leave preprocessor directive indenting as-is. This simplifies handling mixed styles of CPP directive indentation. Fixes #38511
2025-08-26[clang-format] Fix a bug in SkipMacroDefinitionBody (#155346)owenca
All comments before the macro definition body should be skipped.
2025-08-22[clang-format] Fix a bug in SkipMacroDefinitionBody (#154787)owenca
Fixes #154683
2025-07-13[clang-format] Add MacrosSkippedByRemoveParentheses option (#148345)Owen Pan
This allows RemoveParentheses to skip the invocations of function-like macros. Fixes #68354. Fixes #147780.
2025-07-06[clang-format][NFC] Use `empty()` instead of comparing size() to 0 or 1Owen Pan
2025-06-26[clang-format][NFC] Remove `\brief` from comments (#145853)Owen Pan
This was done before in https://reviews.llvm.org/D46320
2025-06-09[clang-format] Parse JSON outermost l_brace as braced list brace (#143327)Owen Pan
See https://github.com/llvm/llvm-project/issues/65400#issuecomment-2922181979.
2025-06-05[clang-format] Handle requires clause following a pointer type (#142893)Owen Pan
Fix #142818
2025-05-31[Format] Remove unused includes (NFC) (#142296)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-05-09[clang-format] Handle Java record (#139215)Owen Pan
Fix #62089
2025-05-02[clang-format] Fix a crash on formatting missing r_paren/r_brace (#138230)Owen Pan
Fix #138097
2025-05-02[clang-format] RemoveParentheses shouldn't remove empty parentheses (#138229)Owen Pan
Fix #138124
2025-04-26[clang-format] Correctly handle C# new modifier (#137430)Owen Pan
Fix #75815
2025-04-25[clang-format][NFC] Use UnwrappedLineParser::eof() whenever possibleOwen Pan
2025-04-25[clang-format] Correctly handle C# where clause (#137295)Owen Pan
Fix #74947
2025-04-24[clang-format] Correctly identify include guards (#137112)Owen Pan
Fix #136814
2025-04-22[clang-format] Fix a bug in parsing C-style cast of lambdas (#136099)Owen Pan
Fix #135959
2025-04-16[clang-format] Fix a bug in BWACS_MultiLine (#135906)Owen Pan
Fix #51940
2025-04-12[clang-format][NFC] Add isJava() and isTextProto() in FormatStyle (#135466)Owen Pan
Also remove redundant name qualifiers format::, FormatStyle::, and LanguageKind::.
2025-04-10[clang-format] Recognize TableGen paste operator on separate line (#133722)sstwcw
Formatting this piece of code made the program crash. ``` class TypedVecListRegOperand<RegisterClass Reg, int lanes, string eltsize> : RegisterOperand<Reg, "printTypedVectorList<" # lanes # ", '" # eltsize # "'>">; ``` The line starting with the `#` was treated as a separate preprocessor directive line. Then the code dereferenced a null pointer when it tried to continue parsing the first line that did not end in a semicolon. Now the 2 problems are fixed.
2025-04-09[clang-format][NFC] Add FormatToken::is(tok::ObjCKeywordKind) (#134973)Owen Pan
This allows simplification of code that checks if a token is an Objective-C keyword. Also, delete the following in UnwrappedLineParser::parseStructuralElement(): - an else-after-break in the tok::at case - the copypasted code in the tok::objc_autoreleasepool case
2025-04-05[clang-format] Set C11 instead of C17 for LK_C (#134472)Owen Pan
Fix #134453
2025-04-02[clang-format] Fix a bug in annotating braces (#134039)Owen Pan
Fix #133873
2025-03-25[clang-format] Correctly annotate requires clause in `&& requires(` (#132882)Owen Pan
Fix #132334
2025-03-10[clang-format] Don't remove parentheses separated from ellipsis by comma ↵Owen Pan
(#130471) Also clean up `case tok::r_paren` in `UnwrappedLineParser::parseParens()`. Fix #130359
2025-03-06[clang-format] Remove special handling of C++ access specifiers in C (#129983)Owen Pan
This effectively reverts d1aed486efc6d35a81ca4acbabb4203c4b91cda9 because of #129426.
2025-03-05[clang-format][NFC] Use better names for a couple of data membersOwen Pan
2025-03-03[clang-format] Fix a bug in wrapping function return type (#129374)Owen Pan
Fixes #113766
2025-02-26[clang-format] Fix a bug that changes keyword `or` to an identifier (#128410)Owen Pan
Fixes #105482
2025-02-23[clang-format] Add the C language instead of treating it like C++ (#128287)Owen Pan
Closes #128120
2025-02-16[clang-format] Fix a bug in annotating braces (#127306)Owen Pan
Fixes #107616.
2025-02-01[clang-format] Fix a bug in annotating ClassHeadName (#125326)Owen Pan
2025-01-30[clang-format] Add ClassHeadName to help annotating StartOfName (#124891)Owen Pan
Fixes #124574.
2025-01-30[clang-format] Fix a crash on parsing requires clause (#125021)Owen Pan
Fixes #124921.
2025-01-27[clang-format] Treat uppercase identifiers after struct as macros (#124397)Owen Pan
This restores the behavior before llvmorg-20-init. Fixes #94184. Fixes #117477. Fixes #122690. Fixes #123142.
2025-01-21[clang-format] Rename ExportBlockIndentation -> IndentExportBlock (#123493)Sirraide
This renames the `ExportBlockIndentation` option and adds a config parse test, as requested in #110381.
2025-01-19[clang-format] Improve brace wrapping and add an option to control ↵Sirraide
indentation of `export { ... }` (#110381) `export { ... }` blocks can get a bit long, so I thought it would make sense to have an option that makes it so their contents are not indented (basically the same argument as for namespaces). This is based on the `NamespaceIndentation` option, except that there is no option to control the behaviour of `export` blocks when nested because nesting them doesn’t really make sense. Additionally, brace wrapping of short `export { ... }` blocks is now controlled by the `AllowShortBlocksOnASingleLine` option. There is no separate option just for `export` blocks because you can just write e.g. `export int x;` instead of `export { int x; }`. This closes #121723.
2025-01-17[clang-format] Correctly annotate braces in macro definitions (#123279)Owen Pan
Fixes #123179.
2025-01-04[clang-format] Add `TT_CompoundRequirementLBrace` for better annotation ↵Owen Pan
(#121539) Also, add `ST_CompoundRequirement` to help annotating */&/&& in compound requirement expressions as `TT_BinaryOperator`. Fixes #121471.
2025-01-04[clang-format] Don't break short macro call followed by l_paren (#121626)Owen Pan
Fixes #105658.
2025-01-04[clang-format] Add TT_AfterPPDirective for better annotation (#121622)Owen Pan
For now, we only need to annotate the token after #error or #warning. Fixes #117706.
2025-01-04[clang-format][NFC] Replace SmallVectorImpl with ArrayRef (#121621)Owen Pan
2024-12-18[clang-format] Fix a bug in annotating arrows after init braces (#119958)Owen Pan
Fixes #59066.
2024-12-10[clang-format] Fix idempotent format of hash in macro body (#118513)Owen Pan
Fixes #118334.