================
@@ -3769,7 +3774,20 @@ tooling::Replacements sortJavaImports(const FormatStyle
&Style, StringRef Code,
else if (isClangFormatOn(Trimmed))
FormattingOff = false;
----------------
owenca wrote:
Handle `Trimmed.empty()` at the top of the chained conditional.
```suggestion
} else if (Trimmed.starts_with("//")) {
// Associating comments within the imports with the nearest import below
AssociatedCommentLines.push_back(Line);
} else if (Trimmed.starts_with("/*")) {
... // Extend `Line` for a multiline comment to include all lines the
comment spans.
AssociatedCommentLines.push_back(Line);
} else if (...) { // Package statement
...
} else if (ImportRegex.match(Trimmed, &Matches)) {
// Lines 3773-3785 go here.
} else { // `Trimmed` is neither empty, nor a comment or a package/import
statement.
break;
}
```
And it seems that we don't need `JavaTypeDeclRegexPattern`.
https://github.com/llvm/llvm-project/pull/177326
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits