diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-01-02 12:38:39 -0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2020-01-07 11:19:25 +0100 |
commit | 3d47a5698ba73fc36212b391efb50e88ed7080d5 (patch) | |
tree | e60a0f86d946f377a485f78c7feb8fa0936a54ac /recipes-qt | |
parent | d8f0db7f8dfab14fbc309d215e2674078a871664 (diff) |
qt5-creator: Make clang-format patch work with multiple clang versions
FormatStyle APIs keeps changing with clang versions. So there is no
better way than checking for clang version to decide types, this ensures
that it can build with various clang revs
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-qt')
-rw-r--r-- | recipes-qt/qt5/qt5-creator/0001-clangformat-AllowShortIfStatementsOnASingleLine-is-n.patch | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/recipes-qt/qt5/qt5-creator/0001-clangformat-AllowShortIfStatementsOnASingleLine-is-n.patch b/recipes-qt/qt5/qt5-creator/0001-clangformat-AllowShortIfStatementsOnASingleLine-is-n.patch index 1bc3632d..7338f02b 100644 --- a/recipes-qt/qt5/qt5-creator/0001-clangformat-AllowShortIfStatementsOnASingleLine-is-n.patch +++ b/recipes-qt/qt5/qt5-creator/0001-clangformat-AllowShortIfStatementsOnASingleLine-is-n.patch @@ -18,19 +18,36 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> src/plugins/clangformat/clangformatutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp -index 09a3150c89..7d8a95ae18 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp -@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle() +@@ -57,10 +57,18 @@ static clang::format::FormatStyle qtcSty + style.AlignOperands = true; + style.AlignTrailingComments = true; + style.AllowAllParametersOfDeclarationOnNextLine = true; ++#if Q_CC_CLANG < 1000 style.AllowShortBlocksOnASingleLine = false; ++#else ++ style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; ++#endif style.AllowShortCaseLabelsOnASingleLine = false; style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; -- style.AllowShortIfStatementsOnASingleLine = false; ++#if Q_CC_CLANG < 900 + style.AllowShortIfStatementsOnASingleLine = false; ++#else + style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; ++#endif style.AllowShortLoopsOnASingleLine = false; style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; style.AlwaysBreakBeforeMultilineStrings = false; --- -2.23.0 - +@@ -68,7 +76,11 @@ static clang::format::FormatStyle qtcSty + style.BinPackArguments = false; + style.BinPackParameters = false; + style.BraceWrapping.AfterClass = true; ++#if Q_CC_CLANG < 1000 + style.BraceWrapping.AfterControlStatement = false; ++#else ++ style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Never; ++#endif + style.BraceWrapping.AfterEnum = false; + style.BraceWrapping.AfterFunction = true; + style.BraceWrapping.AfterNamespace = false; |