summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/BreakableToken.h
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2017-11-17 11:17:15 +0000
committerManuel Klimek <klimek@google.com>2017-11-17 11:17:15 +0000
commit7786614350986a58a1864c9003b67c0dcdbf1b77 (patch)
tree4a7e37af910209a0e9a45f5580fd52162035dcde /clang/lib/Format/BreakableToken.h
parentdd9ea751e1ddf8dab14cfb49b7a0e92ea4dacaec (diff)
downloadbcm5719-llvm-7786614350986a58a1864c9003b67c0dcdbf1b77.tar.gz
bcm5719-llvm-7786614350986a58a1864c9003b67c0dcdbf1b77.zip
Implement more accurate penalty & trade-offs while breaking protruding tokens.
For each line that we break in a protruding token, compute whether the penalty of breaking is actually larger than the penalty of the excess characters. Only break if that is the case. llvm-svn: 318515
Diffstat (limited to 'clang/lib/Format/BreakableToken.h')
-rw-r--r--clang/lib/Format/BreakableToken.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h
index 8c2dc741d1e..0bfc5edc1fc 100644
--- a/clang/lib/Format/BreakableToken.h
+++ b/clang/lib/Format/BreakableToken.h
@@ -137,9 +137,9 @@ 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 {
+ /// \brief Returns whether there will be a line break at the start of the
+ /// token.
+ virtual bool introducesBreakBeforeToken() const {
return false;
}
@@ -347,7 +347,7 @@ public:
Split getSplitBefore(unsigned LineIndex, unsigned PreviousEndColumn,
unsigned ColumnLimit,
llvm::Regex &CommentPragmasRegex) const override;
- bool introducesBreakBefore(unsigned LineIndex) const override;
+ bool introducesBreakBeforeToken() const override;
unsigned getLineLengthAfterSplitBefore(unsigned LineIndex,
unsigned TailOffset,
unsigned PreviousEndColumn,
OpenPOWER on IntegriCloud