summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.h')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h
index 010bad8ecea..500054fe9a2 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -34,7 +34,7 @@ namespace format {
struct FormatToken {
FormatToken()
: NewlinesBefore(0), HasUnescapedNewline(false), WhiteSpaceLength(0),
- TokenLength(0), IsFirst(false) {
+ TokenLength(0), IsFirst(false), MustBreakBefore(false) {
}
/// \brief The \c Token.
@@ -68,6 +68,12 @@ struct FormatToken {
/// \brief Indicates that this is the first token.
bool IsFirst;
+ /// \brief Whether there must be a line break before this token.
+ ///
+ /// This happens for example when a preprocessor directive ended directly
+ /// before the token.
+ bool MustBreakBefore;
+
// FIXME: We currently assume that there is exactly one token in this vector
// except for the very last token that does not have any children.
/// \brief All tokens that logically follow this token.
@@ -144,10 +150,11 @@ private:
// FIXME: We are constantly running into bugs where Line.Level is incorrectly
// subtracted from beyond 0. Introduce a method to subtract from Line.Level
// and use that everywhere in the Parser.
- UnwrappedLine Line;
+ llvm::OwningPtr<UnwrappedLine> Line;
bool RootTokenInitialized;
FormatToken *LastInCurrentLine;
FormatToken FormatTok;
+ bool MustBreakBeforeNextToken;
const FormatStyle &Style;
FormatTokenSource *Tokens;
OpenPOWER on IntegriCloud