summaryrefslogtreecommitdiffstats
path: root/include/clang
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-10-12 08:19:25 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2019-04-04 06:32:38 +0000
commitfa1b9053729ec6a4425a44ec5502dd388928274a (patch)
tree1fd37f1e5874b79f463c782faa6023e2f12f99c4 /include/clang
parent1c6ea8a0b9c22d674854c09460e2bee4bbd1725b (diff)
[clang-format] Introduce the flag which allows not to shrink lines
-------------------------------------------------------------------------- * https://reviews.llvm.org/D53072 -------------------------------------------------------------------------- Currently there's no way to prevent to lines optimization even if you have intentionally put <CR> to split the line. In general case it's fine. So I would prefer to have such option which you can enable in special cases (for me it's an IDE related use case). Revert this change if upstream clang-format offers better solution. This is a cherry pick from commits b748c82e3664c2e2e3d29645ede472d87b8cde63 and 1817513d4f3a2e4e26be124dbe395340f798fd51. Change-Id: I9d2935b937bb68ea8dc59fac8463718475e9c080 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Format/Format.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h
index cb37b0c890..b9c4df3d1a 100644
--- a/include/clang/Format/Format.h
+++ b/include/clang/Format/Format.h
@@ -22,6 +22,8 @@
#include "llvm/Support/Regex.h"
#include <system_error>
+#define KEEP_LINE_BREAKS_FOR_NON_EMPTY_LINES_BACKPORTED
+
namespace llvm {
namespace vfs {
class FileSystem;
@@ -1200,6 +1202,16 @@ struct FormatStyle {
/// \endcode
bool JavaScriptWrapImports;
+ /// If true, no line breaks are optimized out (works only with ColumnLimit = 0)
+ /// \code
+ /// true: false:
+ /// int foo(int a, vs. int foo(int a, int b) {
+ /// int b) {
+ /// bar(); bar();
+ /// } }
+ /// \endcode
+ bool KeepLineBreaksForNonEmptyLines;
+
/// If true, the empty line at the start of blocks is kept.
/// \code
/// true: false:
@@ -1767,6 +1779,7 @@ struct FormatStyle {
JavaImportGroups == R.JavaImportGroups &&
JavaScriptQuotes == R.JavaScriptQuotes &&
JavaScriptWrapImports == R.JavaScriptWrapImports &&
+ KeepLineBreaksForNonEmptyLines == R.KeepLineBreaksForNonEmptyLines &&
KeepEmptyLinesAtTheStartOfBlocks ==
R.KeepEmptyLinesAtTheStartOfBlocks &&
MacroBlockBegin == R.MacroBlockBegin &&