1From 14eb5b382cabf90352634393c19bf87a4c15766a Mon Sep 17 00:00:00 2001 2From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de> 3Date: Mon, 8 Mar 2021 21:56:06 +0100 4Subject: [PATCH] clangformat: Fix build with LLVM 13 5 6Change-Id: I5eaad17a6f240aa1e3f246492b69f093b4f59fee 7Reviewed-by: David Schulz <david.schulz@qt.io> 8 9Upstream-Status: Accepted [https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=14eb5b382cabf90352634393c19bf87a4c15766a] 10Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> 11--- 12 src/plugins/clangformat/clangformatbaseindenter.cpp | 4 ++++ 13 src/plugins/clangformat/clangformatutils.cpp | 4 ++++ 14 2 files changed, 8 insertions(+) 15 16diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp 17index fb8e693809..6378b2af53 100644 18--- a/src/plugins/clangformat/clangformatbaseindenter.cpp 19+++ b/src/plugins/clangformat/clangformatbaseindenter.cpp 20@@ -42,7 +42,11 @@ void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, 21 ReplacementsToKeep replacementsToKeep) 22 { 23 style.MaxEmptyLinesToKeep = 100; 24+#if LLVM_VERSION_MAJOR >= 13 25+ style.SortIncludes = clang::format::FormatStyle::SI_Never; 26+#else 27 style.SortIncludes = false; 28+#endif 29 style.SortUsingDeclarations = false; 30 31 // This is a separate pass, don't do it unless it's the full formatting. 32diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp 33index a249327d0e..770e75908c 100644 34--- a/src/plugins/clangformat/clangformatutils.cpp 35+++ b/src/plugins/clangformat/clangformatutils.cpp 36@@ -145,7 +145,11 @@ static clang::format::FormatStyle qtcStyle() 37 style.PenaltyReturnTypeOnItsOwnLine = 300; 38 style.PointerAlignment = FormatStyle::PAS_Right; 39 style.ReflowComments = false; 40+#ifdef LLVM_VERSION_MAJOR >= 13 41+ style.SortIncludes = FormatStyle::SI_CaseSensitive; 42+#else 43 style.SortIncludes = true; 44+#endif 45 style.SortUsingDeclarations = true; 46 style.SpaceAfterCStyleCast = true; 47 style.SpaceAfterTemplateKeyword = false; 48-- 492.31.1 50 51