aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2023-11-13 13:41:01 -0800
committerGitHub <noreply@github.com>2023-11-13 13:41:01 -0800
commitfff993b7cfd01f733216bd81d2a18838b7a4a97f (patch)
tree601bd3ad1b0b7de8e66cbd026b1412937c970760 /clang/lib/Format/WhitespaceManager.cpp
parent7fb606e9feb9a4f23acf96ccf73ae676ca883828 (diff)
downloadllvm-fff993b7cfd01f733216bd81d2a18838b7a4a97f.zip
llvm-fff993b7cfd01f733216bd81d2a18838b7a4a97f.tar.gz
llvm-fff993b7cfd01f733216bd81d2a18838b7a4a97f.tar.bz2
[clang-format] Fix a bug in aligning comments in vector of structs (#72099)
Fixed #71825.
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 764a068..32d8b97 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1465,7 +1465,7 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start,
// Account for the added token lengths
Changes[j].Spaces = InitialSpaces - InitialTokenLength;
}
- } else if (C.Tok->is(tok::comment)) {
+ } else if (C.Tok->is(tok::comment) && C.Tok->NewlinesBefore == 0) {
// Trailing comments stay at a space past the last token
C.Spaces = Changes[i - 1].Tok->is(tok::comma) ? 1 : 2;
} else if (C.Tok->is(tok::l_brace)) {