aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qt5-creator/0002-clangformat-Fix-build-with-LLVM-13.patch
blob: d88a4b21e9571f6ccbb0dae85caf0e0de71b7c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From ec82db9b97aa77c499d7f0bf70b130c242fb3c2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de>
Date: Mon, 8 Mar 2021 21:56:06 +0100
Subject: [PATCH] clangformat: Fix build with LLVM 13

Change-Id: I5eaad17a6f240aa1e3f246492b69f093b4f59fee
Reviewed-by: David Schulz <david.schulz@qt.io>

Upstream-Status: Accepted [https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=14eb5b382cabf90352634393c19bf87a4c15766a]
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 src/plugins/clangformat/clangformatbaseindenter.cpp | 4 ++++
 src/plugins/clangformat/clangformatutils.cpp        | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp
index fb8e693809..6378b2af53 100644
--- a/src/plugins/clangformat/clangformatbaseindenter.cpp
+++ b/src/plugins/clangformat/clangformatbaseindenter.cpp
@@ -42,7 +42,11 @@ 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
     style.SortUsingDeclarations = false;
 
     // This is a separate pass, don't do it unless it's the full formatting.
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index a249327d0e..770e75908c 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -145,7 +145,11 @@ static clang::format::FormatStyle qtcStyle()
     style.PenaltyReturnTypeOnItsOwnLine = 300;
     style.PointerAlignment = FormatStyle::PAS_Right;
     style.ReflowComments = false;
+#ifdef LLVM_VERSION_MAJOR >= 13
+    style.SortIncludes = FormatStyle::SI_CaseSensitive;
+#else
     style.SortIncludes = true;
+#endif
     style.SortUsingDeclarations = true;
     style.SpaceAfterCStyleCast = true;
     style.SpaceAfterTemplateKeyword = false;