summaryrefslogtreecommitdiff
path: root/clang/unittests/Format/SortImportsTestJava.cpp
AgeCommit message (Collapse)Author
2025-05-19[clang-format][NFC] Upgrade SortIncludes option to a struct (#140497)Owen Pan
This allows adding other suboptions e.g. IgnoreExtension in #137840.
2024-05-20[clang-format][NFC] Remove redundnat llvm::, clang::, etc.Owen Pan
2023-10-27[clang-format][NFC] Remove extraneous newlines in remaining unit testsOwen Pan
2021-02-02[clang-format] Add case aware include sorting.Kent Sommer
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor of the current ASCIIbetical sorting style. Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks Differential Revision: https://reviews.llvm.org/D95017
2020-09-18[clang-format] Add a option for the position of Java static importmydeveloperday
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
2019-10-01[clang-format] [PR43372] - clang-format shows replacements in DOS files when ↵Paul Hoad
no replacement is needed Summary: This is a patch to fix PR43372 (https://bugs.llvm.org/show_bug.cgi?id=43372) - clang-format can't format file with includes, ( which really keep providing replacements for already sorted headers.) A similar issue was addressed by @krasimir in {D60199}, however, this seemingly only prevented the issue when the files being formatted did not contain windows line endings (\r\n) It's possible this is related to https://twitter.com/StephanTLavavej/status/1176722938243895296 given who @STL_MSFT works for! As people often used the existence of replacements to determine if a file needs clang-formatting, this is probably pretty important for windows users There may be a better way of comparing 2 strings and ignoring \r (which appear in both Results and Code), I couldn't choose between this idiom or the copy_if approach, but I'm happy to change it to whatever people consider more performant. Reviewers: krasimir, klimek, owenpan, ioeric Reviewed By: krasimir Subscribers: cfe-commits, STL_MSFT, krasimir Tags: #clang-format, #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D68227 llvm-svn: 373388
2019-03-30[clang-format] [PR41187] moves Java import statements to the wrong location ↵Paul Hoad
if code contains statements that start with the word import Summary: Import sorting of java file, incorrectly move import statement to after a function beginning with the word import. Make 1 character change to regular expression to ensure there is always at least one space/tab after the word import Previously clang-format --style="LLVM" would format ``` import X; class C { void m() { importFile(); } } ``` as ``` class C { void m() { importFile(); import X; } } ``` Reviewers: djasper, klimek, reuk, JonasToth Reviewed By: klimek Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D59684 llvm-svn: 357345
2019-02-20[clang-format] Do not emit replacements if Java imports are OKKrasimir Georgiev
Summary: Currently clang-format would always emit a replacement for a block of Java imports even if it is correctly formatted: ``` % cat /tmp/Aggregator.java import X; % clang-format /tmp/Aggregator.java import X; % clang-format -output-replacements-xml /tmp/Aggregator.java <?xml version='1.0'?> <replacements xml:space='preserve' incomplete_format='false'> <replacement offset='0' length='9'>import X;</replacement> </replacements> % ``` This change makes clang-format not emit replacements in this case. Note that there is logic to not emit replacements in this case for C++. Reviewers: ioeric Reviewed By: ioeric Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58436 llvm-svn: 354452
2018-10-05[clang-format] Java import sorting in clang-formatKrasimir Georgiev
Contributed by SamMaier! llvm-svn: 343862