Basically adding an empty TextProto section causes the formatting of TextProto raw strings to change and spaces to be added after the : .
This diff adds a test that reproduces this issus.
It is currently disabled as it is failing, here is the output:
❯ build/tools/clang/unittests/Format/FormatTests --gtest_filter='FormatTestRawStrings.DISABLED*' --gtest_also_run_disabled_tests Note: Google Test filter = FormatTestRawStrings.DISABLED* [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from FormatTestRawStrings [ RUN ] FormatTestRawStrings.DISABLED_FormatsCorrectlyWhenTextProtoIsInOwnSection /home/bjudd/code/llvm-project/clang/unittests/Format/FormatTestRawStrings.cpp:134: Failure Expected equality of these values: Expected Which is: "\nt = R\"pb(item: 1)pb\";" Actual Which is: "\nt = R\"pb(item : 1)pb\";" With diff: @@ -1,2 +1,2 @@ -t = R\"pb(item: 1)pb\"; +t = R\"pb(item : 1)pb\"; [ FAILED ] FormatTestRawStrings.DISABLED_FormatsCorrectlyWhenTextProtoIsInOwnSection (7 ms) [----------] 1 test from FormatTestRawStrings (7 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (7 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] FormatTestRawStrings.DISABLED_FormatsCorrectlyWhenTextProtoIsInOwnSection 1 FAILED TEST
Why such a raw string, instead of just "(...)"?