summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/BreakableToken.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/BreakableToken.h')
-rw-r--r--clang/lib/Format/BreakableToken.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h
index 630e927e8fc..8c2dc741d1e 100644
--- a/clang/lib/Format/BreakableToken.h
+++ b/clang/lib/Format/BreakableToken.h
@@ -58,6 +58,8 @@ struct FormatStyle;
/// operations that might be executed before the main line breaking occurs:
/// - getSplitBefore, for finding a split such that the content preceding it
/// needs to be specially reflown,
+/// - introducesBreakBefore, for checking if reformatting the beginning
+/// of the content introduces a line break before it,
/// - getLineLengthAfterSplitBefore, for calculating the line length in columns
/// of the remainder of the content after the beginning of the content has
/// been reformatted, and
@@ -135,6 +137,12 @@ public:
return Split(StringRef::npos, 0);
}
+ /// \brief Returns if a break before the content at \p LineIndex will be
+ /// inserted after the whitespace preceding the content has been reformatted.
+ virtual bool introducesBreakBefore(unsigned LineIndex) const {
+ return false;
+ }
+
/// \brief Returns the number of columns required to format the piece of line
/// at \p LineIndex after the content preceding the whitespace range specified
/// \p SplitBefore has been reformatted, but before any breaks are made to
@@ -339,6 +347,7 @@ public:
Split getSplitBefore(unsigned LineIndex, unsigned PreviousEndColumn,
unsigned ColumnLimit,
llvm::Regex &CommentPragmasRegex) const override;
+ bool introducesBreakBefore(unsigned LineIndex) const override;
unsigned getLineLengthAfterSplitBefore(unsigned LineIndex,
unsigned TailOffset,
unsigned PreviousEndColumn,
OpenPOWER on IntegriCloud