[clang] [clang-format] Fix extraneous space in block comments ending with **/ (PR #190209)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 7 13:09:22 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 87227 tests passed
* 1376 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang-Unit
<details>
<summary>Clang-Unit.Format/_/FormatTests/42/79</summary>

```
Script(shard):
--
GTEST_OUTPUT=json:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests-Clang-Unit-487422-42-79.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=79 GTEST_SHARD_INDEX=42 /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests
--

Note: This is test shard 43 of 79.
[==========] Running 16 tests from 11 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CleanupTest
[ RUN      ] CleanupTest.NoCleanupsForJavaScript
[       OK ] CleanupTest.NoCleanupsForJavaScript (0 ms)
[----------] 1 test from CleanupTest (0 ms total)

[----------] 5 tests from FormatTest
[ RUN      ] FormatTest.DoesNotBreakSemiAfterClassDecl
[       OK ] FormatTest.DoesNotBreakSemiAfterClassDecl (1 ms)
[ RUN      ] FormatTest.AllowAllArgumentsOnNextLine
[       OK ] FormatTest.AllowAllArgumentsOnNextLine (34 ms)
[ RUN      ] FormatTest.IndentationWithinColumnLimitNotPossible
[       OK ] FormatTest.IndentationWithinColumnLimitNotPossible (3 ms)
[ RUN      ] FormatTest.UnderstandsPragmaOmpTarget
[       OK ] FormatTest.UnderstandsPragmaOmpTarget (4 ms)
[ RUN      ] FormatTest.MicrosoftDefaultStyle
[       OK ] FormatTest.MicrosoftDefaultStyle (1 ms)
[----------] 5 tests from FormatTest (46 ms total)

[----------] 1 test from FormatTestComments
[ RUN      ] FormatTestComments.BlockComments
FormatTests: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/BreakableToken.cpp:726: virtual void clang::format::BreakableBlockComment::insertBreak(unsigned int, unsigned int, Split, unsigned int, WhitespaceManager &) const: Assertion `LocalIndentAtLineBreak >= Prefix.size()' failed.
 #0 0x0000000000b28ad8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
 #1 0x0000000000b25d15 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
 #2 0x0000000000b298e1 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
 #3 0x00007c8251780330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00007c82517d9b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #5 0x00007c825178027e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #6 0x00007c82517638ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #7 0x00007c825176381b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #8 0x00007c8251776517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
 #9 0x0000000000bbfd86 basic_string /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:625:4
#10 0x0000000000bbfd86 basic_string /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:177:9
#11 0x0000000000bbfd86 basic_string<llvm::StringRef, void> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:796:4
#12 0x0000000000bbfd86 clang::format::BreakableBlockComment::insertBreak(unsigned int, unsigned int, std::pair<unsigned long, unsigned int>, unsigned int, clang::format::WhitespaceManager&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/BreakableToken.cpp:727:42
#13 0x0000000000bbb6bd clang::format::ContinuationIndenter::breakProtrudingToken(clang::format::FormatToken const&, clang::format::LineState&, bool, bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/ContinuationIndenter.cpp:0:16
#14 0x0000000000bb92ad begin /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/SmallVector.h:273:45
#15 0x0000000000bb92ad end /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/SmallVector.h:275:27
#16 0x0000000000bb92ad ~SmallVector /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/SmallVector.h:1211:46
#17 0x0000000000bb92ad ~LineState /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/ContinuationIndenter.h:451:8
#18 0x0000000000bb92ad clang::format::ContinuationIndenter::handleEndOfLine(clang::format::FormatToken const&, clang::format::LineState&, bool, bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/ContinuationIndenter.cpp:2534:3
#19 0x0000000000bb35f8 clang::format::ContinuationIndenter::moveStateToNextToken(clang::format::LineState&, bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/ContinuationIndenter.cpp:1923:7
#20 0x0000000000bb2d54 clang::format::ContinuationIndenter::getInitialState(unsigned int, unsigned int, clang::format::AnnotatedLine const*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/ContinuationIndenter.cpp:369:1
#21 0x0000000000bff8fa formatLine /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/UnwrappedLineFormatter.cpp:1309:12
#22 0x0000000000bff8fa clang::format::UnwrappedLineFormatter::format(llvm::SmallVectorImpl<clang::format::AnnotatedLine*> const&, bool, int, bool, unsigned int, unsigned int, unsigned int) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/UnwrappedLineFormatter.cpp:1579:25
#23 0x0000000000b988dc clang::format::(anonymous namespace)::Formatter::analyze(clang::format::TokenAnnotator&, llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&, clang::format::FormatTokenLexer&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:2889:14
#24 0x0000000000be9d9b clang::format::TokenAnalyzer::process(bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/TokenAnalyzer.cpp:129:5
#25 0x0000000000bacd8d operator() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:4264:5
#26 0x0000000000bacd8d __invoke_impl<std::pair<clang::tooling::Replacements, unsigned int>, (lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:4263:23) &, const clang::format::Environment &> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61:14
#27 0x0000000000bacd8d __invoke_r<std::pair<clang::tooling::Replacements, unsigned int>, (lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:4263:23) &, const clang::format::Environment &> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:114:9
#28 0x0000000000bacd8d std::_Function_handler<std::pair<clang::tooling::Replacements, unsigned int> (clang::format::Environment const&), clang::format::internal::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus*)::$_12>::_M_invoke(std::_Any_data const&, clang::format::Environment const&) /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290:9
#29 0x0000000000b8ff21 clang::format::internal::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:4280:9
#30 0x0000000000b90fc3 _Rb_tree_impl /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_tree.h:689:12
#31 0x0000000000b90fc3 _Rb_tree /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_tree.h:956:7
#32 0x0000000000b90fc3 set /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_set.h:233:7
#33 0x0000000000b90fc3 Replacements /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Tooling/Core/Replacement.h:212:7
#34 0x0000000000b90fc3 clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, clang::format::FormattingAttemptStatus*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Format/Format.cpp:4322:10
#35 0x00000000004eebb1 clang::format::test::FormatTestBase::format[abi:cxx11](llvm::StringRef, std::optional<clang::format::FormatStyle> const&, clang::format::test::FormatTestBase::StatusCheck, std::vector<clang::tooling::Range, std::allocator<clang::tooling::Range>> const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:0:9
#36 0x00000000004ee0ed Compare<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nullptr> /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1398:12
#37 0x00000000004ee0ed clang::format::test::FormatTestBase::_verifyFormat(char const*, int, llvm::StringRef, llvm::StringRef, std::optional<clang::format::FormatStyle> const&, std::vector<clang::tooling::Range, std::allocator<clang::tooling::Range>> const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90:5
#38 0x000000000086bfa2 ~_Vector_base /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:369:24
#39 0x000000000086bfa2 ~vector /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:738:7
#40 0x000000000086bfa2 clang::format::test::(anonymous namespace)::FormatTestComments_BlockComments_Test::TestBody() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestComments.cpp:2436:3
#41 0x0000000000b3e400 os_stack_trace_getter /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:6240:7
#42 0x0000000000b3e400 testing::Test::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:2695:9
#43 0x0000000000b3f1e0 os_stack_trace_getter /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:6240:7
#44 0x0000000000b3f1e0 testing::TestInfo::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:2842:11
#45 0x0000000000b3fdf3 testing::TestSuite::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:3018:35
#46 0x0000000000b51004 testing::internal::UnitTestImpl::RunAllTests() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:5922:41
#47 0x0000000000b503b9 testing::UnitTest::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:5485:10
#48 0x0000000000b2a6ca main /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/UnitTestMain/TestMain.cpp:55:3
#49 0x00007c82517651ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#50 0x00007c825176528b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#51 0x00000000004ec265 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests+0x4ec265)

--
exit: -6
--
shard JSON output does not exist: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests-Clang-Unit-487422-42-79.json
```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests/FormatTest/OptimizeBreakPenaltyVsExcess</summary>

```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format/./FormatTests --gtest_filter=FormatTest.OptimizeBreakPenaltyVsExcess
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
  ExpectedCode
    Which is: "/*\n *\t9012345\n * /8901\n */"
  FormattedCode
    Which is: "/*\n *\t9012345\n* /8901\n */"
With diff:
@@ -1,4 +1,4 @@
 /*
  *\t9012345
- * /8901
+* /8901
  */

Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:19738: /*
 *	9012345 /8901
 */

/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTestBase.h:90
Expected equality of these values:
  ExpectedCode
    Which is: "/*\n *345678\n *\t/8901\n */"
  FormattedCode
    Which is: "/*\n *345678\n* /8901\n */"
With diff:
@@ -1,4 +1,4 @@
 /*
  *345678
- *\t/8901
+* /8901
  */

Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:19746: /*
 *345678	/8901
 */


```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the cfe-commits mailing list