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>
This commit is contained in:
Christian Stenger
2024-02-14 12:57:15 +01:00
parent 4c4d297d15
commit a5c4c34c9a
5 changed files with 5 additions and 42 deletions

View File

@@ -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.

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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;