summaryrefslogtreecommitdiff
path: root/clang/lib/Format/TokenAnalyzer.cpp
AgeCommit message (Collapse)Author
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.
2024-08-04[clang] Construct SmallVector with ArrayRef (NFC) (#101898)Kazu Hirata
2024-05-13Reland "[clang-format] Fix FormatToken::isSimpleTypeSpecifier() (#91712)"Owen Pan
Remove FormatToken::isSimpleTypeSpecifier() and call Token::isSimpleTypeSpecifier(LangOpts) instead.
2024-05-12Revert "[clang-format] Fix FormatToken::isSimpleTypeSpecifier() (#91712)"Owen Pan
This reverts commits e62ce1f8842c, 5cd280433e8e, and de641e289269 due to buildbot failures.
2024-05-10[clang-format] Fix FormatToken::isSimpleTypeSpecifier() (#91712)Owen Pan
Remove FormatToken::isSimpleTypeSpecifier() and call Token::isSimpleTypeSpecifier(LangOpts) instead.
2024-03-19Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"Owen Pan
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-16[clang-format][NFC] Delete 100+ redundant #include lines in .cpp filesOwen Pan
2024-02-13Revert "[clang-format][NFC] Make LangOpts global in namespace Format"Owen Pan
This reverts commit 32e65b0b8a743678974c7ca7913c1d6c41bb0772. It seems to break some PowerPC bots. See https://github.com/llvm/llvm-project/pull/81390#issuecomment-1941964803.
2024-02-11Reland "[clang-format][NFC] Make LangOpts global in namespace Format (#81390)"Owen Pan
Restore getFormattingLangOpts().
2024-02-11Revert "[clang-format][NFC] Make LangOpts global in namespace Format (#81390)"Owen Pan
This reverts commit 03f571995b4f0c260254955afd16ec44d0764794. We can't hide getFormattingLangOpts() as it's used by other tools.
2024-02-11[clang-format][NFC] Make LangOpts global in namespace Format (#81390)Owen Pan
2023-02-24[clang-format] Add simple macro replacements in formatting.Manuel Klimek
Add configuration to specify macros. Macros will be expanded, and the code will be parsed and annotated in the expanded state. In a second step, the formatting decisions in the annotated expanded code will be reconstructed onto the original unexpanded macro call. Eventually, this will allow to remove special-case code for various macro options we accumulated over the years in favor of one principled mechanism. Differential Revision: https://reviews.llvm.org/D144170
2022-09-18[clang-format] Skip token annotation in passes that don't need itowenca
Differential Revision: https://reviews.llvm.org/D134103
2022-02-03[clang-format] Reserve vectors when the number of items is known beforehand. ↵Marek Kurdej
NFC.
2022-02-03[clang-format] Use back() instead of rbegin(). NFC.Marek Kurdej
2022-02-01[clang-format] Use ranged for loops. NFC.Marek Kurdej
2022-01-07[clang-format] Use range-for loops. NFC.Marek Kurdej
* Avoid if check on every element of the loop when printing symbols.
2022-01-07[clang-format] Use range-for loops. NFC.Marek Kurdej
Reviewed By: MyDeveloperDay, owenpan Differential Revision: https://reviews.llvm.org/D116795
2021-11-24[clang-format] NFC - recent changes caused clang-format to no longer be ↵mydeveloperday
clang-formatted. The following 2 commits caused files in clang-format to no longer be clang-formatted. we would lose our "clean" status https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormattedStatus.html c2271926a4fc - Make clang-format fuzz through Lexing with asserts enabled (https://github.com/llvm/llvm-project/commit/c2271926a4fc ) 84bf5e328664 - Fix various problems found by fuzzing. (https://github.com/llvm/llvm-project/commit/84bf5e328664) Reviewed By: HazardyKnusperkeks, owenpan Differential Revision: https://reviews.llvm.org/D114430
2021-11-19Make clang-format fuzz through Lexing with asserts enabled.Manuel Klimek
Makes clang-format bail out if an in-memory source file with an unsupported BOM is handed in instead of creating source locations that are violating clang's assumptions. In the future, we should add support to better transport error messages like this through clang-format instead of printing to stderr and not creating any changes.
2020-07-07Hand Allocator and IdentifierTable into FormatTokenLexer.Manuel Klimek
This allows us to share the allocator in the future so we can create tokens while parsing. Differential Revision: https://reviews.llvm.org/D83218
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-05-15[clang] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Explicitly avoided changing the strings in the clang-format tests. Differential Revision: https://reviews.llvm.org/D44975 llvm-svn: 332350
2018-05-09Add SourceManagerForFile helper which sets up SourceManager and dependencies ↵Eric Liu
for a single file with code snippet Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets. Reviewers: sammccall, klimek Reviewed By: sammccall Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D46176 llvm-svn: 331923
2018-05-09Remove \brief commands from doxygen comments.Adrian Prantl
This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
2017-10-30[clang-format] Format raw string literalsKrasimir Georgiev
Summary: This patch adds raw string literal formatting. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: klimek, mgorny Differential Revision: https://reviews.llvm.org/D35943 llvm-svn: 316903
2017-09-20clang-format clang-format.Manuel Klimek
llvm-svn: 313744
2016-10-19Don't copy replacements in for-range loop. NFC.Benjamin Kramer
llvm-svn: 284589
2016-09-02clang-format: [JS] merge requoting replacements.Martin Probst
Summary: When formatting source code that needs both requoting and reindentation, merge the replacements to avoid erroring out for conflicting replacements. Also removes the misleading Replacements parameter from the TokenAnalyzer API. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24155 llvm-svn: 280487
2016-08-01Implement tooling::Replacements as a class.Eric Liu
Summary: - Implement clang::tooling::Replacements as a class to provide interfaces to control how replacements for a single file are combined and provide guarantee on the order of replacements being applied. - tooling::Replacements only contains replacements for the same file now. Use std::map<std::string, tooling::Replacements> to represent multi-file replacements. - Error handling for the interface change will be improved in followup patches. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21748 llvm-svn: 277335
2016-05-20clang-format: [JS] sort ES6 imports.Martin Probst
Summary: This change automatically sorts ES6 imports and exports into four groups: absolute imports, parent imports, relative imports, and then exports. Exports are sorted in the same order, but not grouped further. To keep JS import sorting out of Format.cpp, this required extracting the TokenAnalyzer infrastructure to separate header and implementation files. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20198 llvm-svn: 270203