forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/11.0'
Change-Id: I8be5a00000a6699346ed1c44c0711d1f017462a7
This commit is contained in:
@@ -152,14 +152,17 @@ CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings(
|
||||
// to be false
|
||||
settings.indentAccessSpecifiers = (style.AccessModifierOffset != -1 * int(style.IndentWidth));
|
||||
|
||||
settings.indentNamespaceBody = style.NamespaceIndentation
|
||||
== FormatStyle::NamespaceIndentationKind::NI_All;
|
||||
settings.indentNamespaceBraces = settings.indentNamespaceBody;
|
||||
if (style.NamespaceIndentation == FormatStyle::NamespaceIndentationKind::NI_All) {
|
||||
settings.indentNamespaceBody = true;
|
||||
settings.indentNamespaceBraces = settings.indentNamespaceBody;
|
||||
}
|
||||
|
||||
settings.indentClassBraces = style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths;
|
||||
settings.indentEnumBraces = settings.indentClassBraces;
|
||||
settings.indentBlockBraces = settings.indentClassBraces;
|
||||
settings.indentFunctionBraces = settings.indentClassBraces;
|
||||
if (style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) {
|
||||
settings.indentClassBraces = true;
|
||||
settings.indentEnumBraces = settings.indentClassBraces;
|
||||
settings.indentBlockBraces = settings.indentClassBraces;
|
||||
settings.indentFunctionBraces = settings.indentClassBraces;
|
||||
}
|
||||
|
||||
settings.indentSwitchLabels = style.IndentCaseLabels;
|
||||
#if LLVM_VERSION_MAJOR >= 11
|
||||
|
||||
@@ -207,13 +207,13 @@ void fromCppCodeStyleSettings(clang::format::FormatStyle &style,
|
||||
else
|
||||
style.AccessModifierOffset = -1 * style.IndentWidth;
|
||||
|
||||
if (settings.indentNamespaceBody || settings.indentNamespaceBraces)
|
||||
if (settings.indentNamespaceBody && settings.indentNamespaceBraces)
|
||||
style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_All;
|
||||
else
|
||||
style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_None;
|
||||
|
||||
if (settings.indentClassBraces || settings.indentEnumBraces || settings.indentBlockBraces
|
||||
|| settings.indentFunctionBraces)
|
||||
if (settings.indentClassBraces && settings.indentEnumBraces && settings.indentBlockBraces
|
||||
&& settings.indentFunctionBraces)
|
||||
style.BreakBeforeBraces = FormatStyle::BS_Whitesmiths;
|
||||
else
|
||||
style.BreakBeforeBraces = FormatStyle::BS_Custom;
|
||||
|
||||
Reference in New Issue
Block a user