blob: 00f35016c485732e8fc37c1d42eb744499804798 (
plain) (
tree)
|
|
From f4545807defdfb493c1d66a19430a69d81afa40b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <schaepers@kuennecke.com>
Date: Fri, 4 Nov 2022 07:18:50 +0100
Subject: [PATCH] clang-format: Adapt to LLVM 16
Change-Id: I2e35f92db6de10b1e4bf173f0864f0cd893a011f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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 7c83c8e43b2..6072082c8c7 100644
--- a/src/plugins/clangformat/clangformatbaseindenter.cpp
+++ b/src/plugins/clangformat/clangformatbaseindenter.cpp
@@ -55,7 +55,11 @@ void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style,
// This is a separate pass, don't do it unless it's the full formatting.
style.FixNamespaceComments = false;
+#if LLVM_VERSION_MAJOR >= 16
+ style.AlignTrailingComments = {clang::format::FormatStyle::TCAS_Never, 0};
+#else
style.AlignTrailingComments = false;
+#endif
if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore)
return;
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index dbc4a6a347e..3b2901bcc8b 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -64,7 +64,11 @@ clang::format::FormatStyle qtcStyle()
#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;
|