blob: dc9c5394056a5c9eda36153c84e7fd69d9459bb6 (
plain) (
tree)
|
|
From e20bdfae4de90401a518135bc22958549dceda66 Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@qt.io>
Date: Tue, 31 Jan 2023 08:11:29 +0100
Subject: [PATCH] ClangFormat: Adapt to changes in LLVM 16
Change-Id: Ia4a2cf21e351095609d8858f1f9355c6607470f3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
---
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 d61cbf2f1a8..fc08158d2d1 100644
--- a/src/plugins/clangformat/clangformatbaseindenter.cpp
+++ b/src/plugins/clangformat/clangformatbaseindenter.cpp
@@ -38,7 +38,11 @@ void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style,
#else
style.SortIncludes = false;
#endif
+#if LLVM_VERSION_MAJOR >= 16
+ style.SortUsingDeclarations = clang::format::FormatStyle::SUD_Never;
+#else
style.SortUsingDeclarations = false;
+#endif
// This is a separate pass, don't do it unless it's the full formatting.
style.FixNamespaceComments = false;
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index c7eb900fed5..d1d6bee684b 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -152,7 +152,11 @@ clang::format::FormatStyle qtcStyle()
#else
style.SortIncludes = true;
#endif
+#if LLVM_VERSION_MAJOR >= 16
+ style.SortUsingDeclarations = FormatStyle::SUD_Lexicographic;
+#else
style.SortUsingDeclarations = true;
+#endif
style.SpaceAfterCStyleCast = true;
style.SpaceAfterTemplateKeyword = false;
style.SpaceBeforeAssignmentOperators = true;
|