ClangFormat: Prepend a space character to our inserted line comment

Otherwise, we could introduce unwanted syntactical constructs, for
instance if the previous character is an asterisk.

Fixes: QTCREATORBUG-25966
Change-Id: Ic0b535861bc1cb4f5f93d06bb11d0f3c7c583893
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-05 13:25:29 +02:00
parent dcf692d3ff
commit 8cc4bbe4d8
2 changed files with 3 additions and 3 deletions

View File

@@ -301,7 +301,7 @@ int forceIndentWithExtraText(QByteArray &buffer,
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(), buffer,
block.blockNumber()) + block.previous().text().length();
buffer.insert(prevEndOffset, " //");
extraLength += 2;
extraLength += 3;
}
}
buffer.insert(utf8Offset + extraLength, dummyText);

View File

@@ -957,7 +957,7 @@ TEST_F(ClangFormat, ChainedMemberFunctionCalls)
" .func();"));
}
TEST_F(ClangFormat, DISABLED_CommentBlock)
TEST_F(ClangFormat, CommentBlock)
{
insertLines({"/****************************************************************************",
"**",