diff options
author | Christian Stenger <christian.stenger@qt.io> | 2024-02-14 12:57:15 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2024-02-15 07:16:28 +0000 |
commit | a5c4c34c9ab49a21aefa42456b5a8cc04e7fbff1 (patch) | |
tree | fd34bbe1504f02902c6ce6335cac77b0ddacd969 | |
parent | 4c4d297d1500a555ea120eb41dcfbf39f6eae407 (diff) |
Raise minimum supported libclang
ClangFormat needs 14.0+ nowadays.
Change-Id: Ib5e38c79c5ec629fed4e5d8da5435769a71b2626
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | qbs/modules/libclang/functions.js | 2 | ||||
-rw-r--r-- | src/plugins/clangformat/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/clangformat/clangformatbaseindenter.cpp | 4 | ||||
-rw-r--r-- | src/plugins/clangformat/clangformatutils.cpp | 35 |
5 files changed, 5 insertions, 42 deletions
@@ -44,11 +44,11 @@ Prerequisites: * Qt WebEngine module for QtWebEngine based help viewer * On Windows: * MinGW with GCC 9 or Visual Studio 2019 or later - * Python 3.5 or later (optional, needed for the python enabled debug helper) + * Python 3.8 or later (optional, needed for the python enabled debug helper) * Debugging Tools for Windows (optional, for MSVC debugging support with CDB) * On Mac OS X: latest Xcode * On Linux: GCC 9 or later -* LLVM/Clang 10 or later (optional, LLVM/Clang 14 is recommended. +* LLVM/Clang 14 or later (optional, LLVM/Clang 17 is recommended. See [instructions](#getting-llvmclang-for-the-clang-code-model) on how to get LLVM. The ClangFormat plugin uses the LLVM C++ API. diff --git a/qbs/modules/libclang/functions.js b/qbs/modules/libclang/functions.js index c1cd5c237e..0d3c5afb87 100644 --- a/qbs/modules/libclang/functions.js +++ b/qbs/modules/libclang/functions.js @@ -1,7 +1,7 @@ var Environment = require("qbs.Environment") var File = require("qbs.File") var FileInfo = require("qbs.FileInfo") -var MinimumLLVMVersion = "8.0.0" // CLANG-UPGRADE-CHECK: Adapt minimum version numbers. +var MinimumLLVMVersion = "14.0.0" // CLANG-UPGRADE-CHECK: Adapt minimum version numbers. var Process = require("qbs.Process") var Utilities = require("qbs.Utilities") diff --git a/src/plugins/clangformat/CMakeLists.txt b/src/plugins/clangformat/CMakeLists.txt index f1dc569333..30bc50dd2c 100644 --- a/src/plugins/clangformat/CMakeLists.txt +++ b/src/plugins/clangformat/CMakeLists.txt @@ -1,5 +1,5 @@ add_qtc_plugin(ClangFormat - CONDITION TARGET ${CLANG_FORMAT_LIB} AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 10.0.0 AND (QTC_CLANG_BUILDMODE_MATCH OR CLANGTOOLING_LINK_CLANG_DYLIB) + CONDITION TARGET ${CLANG_FORMAT_LIB} AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 14.0.0 AND (QTC_CLANG_BUILDMODE_MATCH OR CLANGTOOLING_LINK_CLANG_DYLIB) DEPENDS Utils Qt::Widgets ${CLANG_FORMAT_LIB} PLUGIN_DEPENDS Core TextEditor CppEditor ProjectExplorer SOURCES diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index 2de357b112..1d5dc2730c 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -42,11 +42,7 @@ static void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, ReplacementsToKeep replacementsToKeep) { style.MaxEmptyLinesToKeep = 100; -#if LLVM_VERSION_MAJOR >= 13 style.SortIncludes = clang::format::FormatStyle::SI_Never; -#else - style.SortIncludes = false; -#endif #if LLVM_VERSION_MAJOR >= 16 style.SortUsingDeclarations = clang::format::FormatStyle::SUD_Never; #else diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index 6d16ebe9aa..4036d34f6d 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -42,37 +42,22 @@ clang::format::FormatStyle calculateQtcStyle() #if LLVM_VERSION_MAJOR >= 15 style.AlignConsecutiveAssignments = {false, false, false, false, false}; style.AlignConsecutiveDeclarations = {false, false, false, false, false}; -#elif LLVM_VERSION_MAJOR >= 12 +#else style.AlignConsecutiveAssignments = FormatStyle::ACS_None; style.AlignConsecutiveDeclarations = FormatStyle::ACS_None; -#else - style.AlignConsecutiveAssignments = false; - style.AlignConsecutiveDeclarations = false; #endif style.AlignEscapedNewlines = FormatStyle::ENAS_DontAlign; -#if LLVM_VERSION_MAJOR >= 11 style.AlignOperands = FormatStyle::OAS_Align; -#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; -#else - style.AllowShortBlocksOnASingleLine = false; -#endif style.AllowShortCaseLabelsOnASingleLine = false; style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; -#if LLVM_VERSION_MAJOR >= 9 style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; -#else - style.AllowShortIfStatementsOnASingleLine = false; -#endif style.AllowShortLoopsOnASingleLine = false; style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; style.AlwaysBreakBeforeMultilineStrings = false; @@ -80,11 +65,7 @@ clang::format::FormatStyle calculateQtcStyle() style.BinPackArguments = false; style.BinPackParameters = false; style.BraceWrapping.AfterClass = true; -#if LLVM_VERSION_MAJOR >= 10 style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Never; -#else - style.BraceWrapping.AfterControlStatement = false; -#endif style.BraceWrapping.AfterEnum = false; style.BraceWrapping.AfterFunction = true; style.BraceWrapping.AfterNamespace = false; @@ -119,11 +100,7 @@ clang::format::FormatStyle calculateQtcStyle() style.ExperimentalAutoDetectBinPacking = false; style.FixNamespaceComments = true; style.ForEachMacros = {"forever", "foreach", "Q_FOREACH", "BOOST_FOREACH"}; -#if LLVM_VERSION_MAJOR >= 12 style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200, 200, true}}; -#else - style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200, 200}}; -#endif style.IncludeStyle.IncludeIsMainRegex = "(Test)?$"; style.IndentCaseLabels = false; style.IndentWidth = 4; @@ -148,11 +125,7 @@ clang::format::FormatStyle calculateQtcStyle() style.PenaltyReturnTypeOnItsOwnLine = 300; style.PointerAlignment = FormatStyle::PAS_Right; style.ReflowComments = false; -#if LLVM_VERSION_MAJOR >= 13 style.SortIncludes = FormatStyle::SI_CaseSensitive; -#else - style.SortIncludes = true; -#endif #if LLVM_VERSION_MAJOR >= 16 style.SortUsingDeclarations = FormatStyle::SUD_Lexicographic; #else @@ -166,11 +139,7 @@ clang::format::FormatStyle calculateQtcStyle() style.SpaceInEmptyParentheses = false; #endif style.SpacesBeforeTrailingComments = 1; -#if LLVM_VERSION_MAJOR >= 13 style.SpacesInAngles = FormatStyle::SIAS_Never; -#else - style.SpacesInAngles = false; -#endif style.SpacesInContainerLiterals = false; #if LLVM_VERSION_MAJOR >= 17 style.SpacesInParens = FormatStyle::SIPO_Never; @@ -225,9 +194,7 @@ void fromCppCodeStyleSettings(clang::format::FormatStyle &style, style.BreakBeforeBraces = FormatStyle::BS_Custom; style.IndentCaseLabels = settings.indentSwitchLabels; -#if LLVM_VERSION_MAJOR >= 11 style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels; -#endif if (settings.extraPaddingForConditionsIfConfusingAlign) style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; |