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) {
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
void WhitespaceManager::generateChanges() {
for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
const Change &C = Changes[i];
+ if (i > 0) {
+ assert(Changes[i - 1].OriginalWhitespaceRange.getBegin() !=
+ C.OriginalWhitespaceRange.getBegin() &&
+ "Generating two replacements for the same location");
+ }
if (C.CreateReplacement) {
std::string ReplacementText = C.PreviousLinePostfix;
if (C.ContinuesPPDirective)