--- qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatbaseindenter.cpp.orig 2022-10-19 16:33:27.000000000 +0300 +++ qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatbaseindenter.cpp 2025-05-28 12:08:22.446994051 +0300 @@ -48,7 +48,7 @@ namespace ClangFormat { namespace { -void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, +static void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, ReplacementsToKeep replacementsToKeep) { style.MaxEmptyLinesToKeep = 100; @@ -57,11 +57,15 @@ #else style.SortIncludes = false; #endif - style.SortUsingDeclarations = false; +// style.SortUsingDeclarations = false; // This is a separate pass, don't do it unless it's the full formatting. style.FixNamespaceComments = false; +#if LLVM_VERSION_MAJOR >= 16 + style.AlignTrailingComments = {clang::format::FormatStyle::TCAS_Never, 0}; +#else style.AlignTrailingComments = false; +#endif if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore) return; @@ -74,7 +78,7 @@ llvm::StringRef clearExtraNewline(llvm::StringRef text) { - while (text.startswith("\n\n")) + while (text.starts_with("\n\n")) text = text.drop_front(); return text; } --- qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatfile.h.orig 2025-05-28 12:09:28.408901129 +0300 +++ qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatfile.h 2025-05-28 17:43:02.211696346 +0300 @@ -55,6 +55,7 @@ void fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSettings &settings); void fromTabSettings(const TextEditor::TabSettings &settings); bool isReadOnly() const; + void setIsReadOnly(bool isReadOnly); private: void saveNewFormat(); @@ -63,7 +64,7 @@ private: Utils::FilePath m_filePath; clang::format::FormatStyle m_style; - const bool m_isReadOnly; + bool m_isReadOnly; }; } // namespace ClangFormat --- qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatutils.cpp.orig 2025-05-28 12:09:28.410047891 +0300 +++ qt-creator-opensource-src-8.0.2/src/plugins/clangformat/clangformatutils.cpp 2025-05-28 17:47:48.443021992 +0300 @@ -56,8 +56,8 @@ style.AccessModifierOffset = -4; style.AlignAfterOpenBracket = FormatStyle::BAS_Align; #if LLVM_VERSION_MAJOR >= 15 - style.AlignConsecutiveAssignments = {false}; - style.AlignConsecutiveDeclarations = {false}; + style.AlignConsecutiveAssignments = {false, false, false, false, false}; + style.AlignConsecutiveDeclarations = {false, false, false, false, false}; #elif LLVM_VERSION_MAJOR >= 12 style.AlignConsecutiveAssignments = FormatStyle::ACS_None; style.AlignConsecutiveDeclarations = FormatStyle::ACS_None; @@ -71,7 +71,11 @@ #else style.AlignOperands = true; #endif +#if LLVM_VERSION_MAJOR >= 16 + style.AlignTrailingComments = {FormatStyle::TCAS_Always, 0}; +#else style.AlignTrailingComments = true; +#endif style.AllowAllParametersOfDeclarationOnNextLine = true; #if LLVM_VERSION_MAJOR >= 10 style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; @@ -86,9 +90,9 @@ style.AllowShortIfStatementsOnASingleLine = false; #endif style.AllowShortLoopsOnASingleLine = false; - style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; + style.BreakAfterReturnType = FormatStyle::RTBS_None; style.AlwaysBreakBeforeMultilineStrings = false; - style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; + style.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; style.BinPackArguments = false; style.BinPackParameters = false; style.BraceWrapping.AfterClass = true; @@ -118,7 +122,11 @@ style.ColumnLimit = 100; style.CommentPragmas = "^ IWYU pragma:"; style.CompactNamespaces = false; +#if LLVM_VERSION_MAJOR >= 15 + style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; +#else style.ConstructorInitializerAllOnOneLineOrOnePerLine = false; +#endif style.ConstructorInitializerIndentWidth = 4; style.ContinuationIndentWidth = 4; style.Cpp11BracedListStyle = true; @@ -138,7 +146,7 @@ style.IndentWrappedFunctionNames = false; style.JavaScriptQuotes = FormatStyle::JSQS_Leave; style.JavaScriptWrapImports = true; - style.KeepEmptyLinesAtTheStartOfBlocks = false; +// style.KeepEmptyLinesAtTheStartOfBlocks = false; // Do not add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE as this will indent lines in between. style.MacroBlockBegin = ""; style.MacroBlockEnd = ""; @@ -161,12 +169,12 @@ #else style.SortIncludes = true; #endif - style.SortUsingDeclarations = true; +// style.SortUsingDeclarations = true; style.SpaceAfterCStyleCast = true; style.SpaceAfterTemplateKeyword = false; style.SpaceBeforeAssignmentOperators = true; style.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements; - style.SpaceInEmptyParentheses = false; +// style.SpaceInEmptyParentheses = false; style.SpacesBeforeTrailingComments = 1; #if LLVM_VERSION_MAJOR >= 13 style.SpacesInAngles = FormatStyle::SIAS_Never; @@ -174,8 +182,8 @@ style.SpacesInAngles = false; #endif style.SpacesInContainerLiterals = false; - style.SpacesInCStyleCastParentheses = false; - style.SpacesInParentheses = false; +// style.SpacesInCStyleCastParentheses = false; +// style.SpacesInParentheses = false; style.SpacesInSquareBrackets = false; style.StatementMacros.emplace_back("Q_OBJECT"); style.StatementMacros.emplace_back("QT_BEGIN_NAMESPACE");