ClangFormat: Do not change incompatible settings

Fixes: QTCREATORBUG-29190
Change-Id: I81730f59f05c8aba718a60deebfeb2b1b3aa0d7f
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-06-06 11:58:11 +02:00
parent 2934e30ad0
commit 07374a7114

View File

@@ -158,8 +158,6 @@ CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings(
settings.indentSwitchLabels = style.IndentCaseLabels;
#if LLVM_VERSION_MAJOR >= 11
settings.indentBlocksRelativeToSwitchLabels = style.IndentCaseBlocks;
settings.indentStatementsRelativeToSwitchLabels = style.IndentCaseBlocks;
settings.indentControlFlowRelativeToSwitchLabels = style.IndentCaseBlocks;
#endif
if (style.DerivePointerAlignment
&& ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) {
@@ -200,9 +198,7 @@ void ClangFormatFile::fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSett
m_style.IndentCaseLabels = settings.indentSwitchLabels;
#if LLVM_VERSION_MAJOR >= 11
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels
|| settings.indentStatementsRelativeToSwitchLabels
|| settings.indentControlFlowRelativeToSwitchLabels;
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels;
#endif
if (settings.extraPaddingForConditionsIfConfusingAlign)