[clang] [clang-format] Option to insert spaces before the closing `*/` (PR #162105)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 28 15:02:05 PDT 2025
================
@@ -1386,6 +1441,23 @@ FormatToken *FormatTokenLexer::getNextToken() {
StringRef UntrimmedText = FormatTok->TokenText;
FormatTok->TokenText = FormatTok->TokenText.rtrim(" \t\v\f");
TrailingWhitespace = UntrimmedText.size() - FormatTok->TokenText.size();
+ FormatTok->setBlockCommentKind(classifyBlockComment(FormatTok->TokenText));
+
+ if (FormatTok->TokenText.starts_with("/*") &&
+ FormatTok->TokenText.ends_with("*/") &&
+ FormatTok->TokenText.size() >= 4) {
+ const StringRef Content =
+ FormatTok->TokenText.drop_front(2).drop_back(2).rtrim("\r\n");
+ if (!Content.empty()) {
+ const unsigned char LastChar =
----------------
HazardyKnusperkeks wrote:
```suggestion
const auto LastChar =
```
https://github.com/llvm/llvm-project/pull/162105
More information about the cfe-commits
mailing list