diff options
author | Daniel Jasper <djasper@google.com> | 2015-01-29 10:47:14 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-01-29 10:47:14 +0000 |
commit | 47b35aeaa14567eb1b5ed82a73f575f18afe3fa5 (patch) | |
tree | e168e4dc9290a79f96f8f7a9e858c5ca262efb35 /clang/lib/Format/UnwrappedLineFormatter.cpp | |
parent | 310e3a8f608fbd9162e42cc50fe316af6713113c (diff) | |
download | llvm-47b35aeaa14567eb1b5ed82a73f575f18afe3fa5.zip llvm-47b35aeaa14567eb1b5ed82a73f575f18afe3fa5.tar.gz llvm-47b35aeaa14567eb1b5ed82a73f575f18afe3fa5.tar.bz2 |
clang-format: Fix crasher caused by not properly setting dry-run.
llvm-svn: 227427
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 6c4aadc..4844b66 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -409,7 +409,7 @@ UnwrappedLineFormatter::format(const SmallVectorImpl<AnnotatedLine *> &Lines, TheLine.Type == LT_ImportStatement) { LineState State = Indenter->getInitialState(Indent, &TheLine, DryRun); while (State.NextToken) { - formatChildren(State, /*Newline=*/false, /*DryRun=*/false, Penalty); + formatChildren(State, /*Newline=*/false, DryRun, Penalty); Indenter->addTokenToState(State, /*Newline=*/false, DryRun); } } else if (Style.ColumnLimit == 0) { @@ -657,8 +657,8 @@ void UnwrappedLineFormatter::addNextStateToQueue(unsigned Penalty, bool UnwrappedLineFormatter::formatChildren(LineState &State, bool NewLine, bool DryRun, unsigned &Penalty) { - FormatToken &Previous = *State.NextToken->Previous; const FormatToken *LBrace = State.NextToken->getPreviousNonComment(); + FormatToken &Previous = *State.NextToken->Previous; if (!LBrace || LBrace->isNot(tok::l_brace) || LBrace->BlockKind != BK_Block || Previous.Children.size() == 0) // The previous token does not open a block. Nothing to do. We don't |