diff --git a/README.md b/README.md index 32b53aacb53..9f4b6f1457d 100644 --- a/README.md +++ b/README.md @@ -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 c1cd5c237e9..0d3c5afb87a 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 f1dc569333f..30bc50dd2c3 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 2de357b1124..1d5dc2730c3 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 6d16ebe9aa1..4036d34f6dc 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 = {{"^= 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;