summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineFormatter.h
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-01-31 11:25:01 +0000
committerDaniel Jasper <djasper@google.com>2017-01-31 11:25:01 +0000
commit7d42f3f7466adb20d820c6538a73dfe972a3dd21 (patch)
treea117b8f2fe9f950a6d301926be0aacf62381a0ee /clang/lib/Format/UnwrappedLineFormatter.h
parent5364cf3b56b7bbf8df992b6d6ea4f7ef42281e51 (diff)
downloadbcm5719-llvm-7d42f3f7466adb20d820c6538a73dfe972a3dd21.tar.gz
bcm5719-llvm-7d42f3f7466adb20d820c6538a73dfe972a3dd21.zip
[clang-format] Refactor WhitespaceManager and friends
The main motivation behind this is to cleanup the WhitespaceManager and make it more extensible for future alignment etc. features. Specifically, WhitespaceManager has started to copy more and more code that is already present in FormatToken. Instead, I think it makes more sense to actually store a reference to each FormatToken for each change. This has as a consequence led to a change in the calculation of indent levels. Now, we actually compute them for each Token ahead of time, which should be more efficient as it removes an unsigned value for the ParenState, which is used during the combinatorial exploration of the solution space. No functional changes intended. Review: https://reviews.llvm.org/D29300 llvm-svn: 293616
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.h')
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.h b/clang/lib/Format/UnwrappedLineFormatter.h
index 7bcead9d25e..93247f71d6e 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.h
+++ b/clang/lib/Format/UnwrappedLineFormatter.h
@@ -44,9 +44,8 @@ public:
private:
/// \brief Add a new line and the required indent before the first Token
/// of the \c UnwrappedLine if there was no structural parsing error.
- void formatFirstToken(FormatToken &RootToken,
- const AnnotatedLine *PreviousLine, unsigned IndentLevel,
- unsigned Indent, bool InPPDirective);
+ void formatFirstToken(const AnnotatedLine &Line,
+ const AnnotatedLine *PreviousLine, unsigned Indent);
/// \brief Returns the column limit for a line, taking into account whether we
/// need an escaped newline due to a continued preprocessor directive.
@@ -57,7 +56,8 @@ private:
// starting from a specific additional offset. Improves performance if there
// are many nested blocks.
std::map<std::pair<const SmallVectorImpl<AnnotatedLine *> *, unsigned>,
- unsigned> PenaltyCache;
+ unsigned>
+ PenaltyCache;
ContinuationIndenter *Indenter;
WhitespaceManager *Whitespaces;
OpenPOWER on IntegriCloud