aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-11-13 09:36:58 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-11-13 12:11:41 +0000
commitccf1d17bfe842e65d353086b2826880d2b361b95 (patch)
tree42ef6e9495a23143eb4f33475a1d1d06f22df11e
parent7a14e38b7e164c4ef7f5dad80f20b4d1b90e5b6d (diff)
Silence the warning about missing initializer for member
Silence the following warning: warning: missing initializer for member ‘clang::tooling::IncludeStyle::IncludeCategory::SortPriority’ [-Wmissing-field-initializers] 118 | style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200}}; According to the docs of IncludeCategories, the SortPriority field is optional, and when not set its value is set to the value of Priority field. So in order to fix the warning we repeat the same value for SortPriority field. In addition we ensure that we require at least clang version 10.0.0. Change-Id: I8baae7a33ad1a7a7f3afe66779f482b29a7396b4 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/plugins/clangformat/CMakeLists.txt2
-rw-r--r--src/plugins/clangformat/clangformatutils.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/clangformat/CMakeLists.txt b/src/plugins/clangformat/CMakeLists.txt
index 3edaead757..9e91349a3c 100644
--- a/src/plugins/clangformat/CMakeLists.txt
+++ b/src/plugins/clangformat/CMakeLists.txt
@@ -1,5 +1,5 @@
add_qtc_plugin(ClangFormat
- CONDITION TARGET libclang
+ CONDITION TARGET libclang AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 10.0.0
DEPENDS Utils Qt5::Widgets clangFormat
INCLUDES "${CLANG_INCLUDE_DIRS}"
PLUGIN_DEPENDS Core TextEditor CppEditor CppTools ProjectExplorer
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index e0eb2827c4..8e11c15364 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -115,7 +115,7 @@ static clang::format::FormatStyle qtcStyle()
style.ExperimentalAutoDetectBinPacking = false;
style.FixNamespaceComments = true;
style.ForEachMacros = {"forever", "foreach", "Q_FOREACH", "BOOST_FOREACH"};
- style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200}};
+ style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200, 200}};
style.IncludeStyle.IncludeIsMainRegex = "(Test)?$";
style.IndentCaseLabels = false;
style.IndentWidth = 4;