[clang] [clang-format] java import sorting should ignore imports in comments and text blocks (PR #177326)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 24 12:05:58 PST 2026


================
@@ -3769,7 +3771,33 @@ tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code,
     else if (isClangFormatOn(Trimmed))
       FormattingOff = false;
 
-    if (ImportRegex.match(Line, &Matches)) {
+    // Track block comments (/* ... */)
+    // Check if we're starting a block comment on this line
----------------
HazardyKnusperkeks wrote:

```suggestion
    // Check if we're starting a block comment on this line.
```
End comments in full stop. (Here and everywhere else.)

https://github.com/llvm/llvm-project/pull/177326


More information about the cfe-commits mailing list