forked from OSchip/llvm-project
[clang-format][NFC] Add a default value to parseBlock()
Differential Revision: https://reviews.llvm.org/D114073
This commit is contained in:
parent
eb8650a757
commit
e852cc0d5a
|
@ -385,7 +385,7 @@ void UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
|
||||||
// be in a non-declaration context.
|
// be in a non-declaration context.
|
||||||
if (!FormatTok->is(TT_MacroBlockBegin) && tryToParseBracedList())
|
if (!FormatTok->is(TT_MacroBlockBegin) && tryToParseBracedList())
|
||||||
continue;
|
continue;
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
break;
|
break;
|
||||||
case tok::r_brace:
|
case tok::r_brace:
|
||||||
|
@ -1313,7 +1313,7 @@ void UnwrappedLineParser::parseStructuralElement(bool IsTopLevel) {
|
||||||
if (Style.BraceWrapping.AfterControlStatement ==
|
if (Style.BraceWrapping.AfterControlStatement ==
|
||||||
FormatStyle::BWACS_Always)
|
FormatStyle::BWACS_Always)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
}
|
}
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
return;
|
return;
|
||||||
|
@ -1326,7 +1326,7 @@ void UnwrappedLineParser::parseStructuralElement(bool IsTopLevel) {
|
||||||
if (Style.BraceWrapping.AfterControlStatement ==
|
if (Style.BraceWrapping.AfterControlStatement ==
|
||||||
FormatStyle::BWACS_Always)
|
FormatStyle::BWACS_Always)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
}
|
}
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
return;
|
return;
|
||||||
|
@ -1434,7 +1434,7 @@ void UnwrappedLineParser::parseStructuralElement(bool IsTopLevel) {
|
||||||
if (Style.BraceWrapping.AfterFunction)
|
if (Style.BraceWrapping.AfterFunction)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
FormatTok->setType(TT_FunctionLBrace);
|
FormatTok->setType(TT_FunctionLBrace);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2078,7 +2078,7 @@ void UnwrappedLineParser::parseIfThenElse() {
|
||||||
bool NeedsUnwrappedLine = false;
|
bool NeedsUnwrappedLine = false;
|
||||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
if (Style.BraceWrapping.BeforeElse)
|
if (Style.BraceWrapping.BeforeElse)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
else
|
else
|
||||||
|
@ -2096,7 +2096,7 @@ void UnwrappedLineParser::parseIfThenElse() {
|
||||||
parseSquare();
|
parseSquare();
|
||||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else if (FormatTok->Tok.is(tok::kw_if)) {
|
} else if (FormatTok->Tok.is(tok::kw_if)) {
|
||||||
FormatToken *Previous = AllTokens[Tokens->getPosition() - 1];
|
FormatToken *Previous = AllTokens[Tokens->getPosition() - 1];
|
||||||
|
@ -2158,7 +2158,7 @@ void UnwrappedLineParser::parseTryCatch() {
|
||||||
}
|
}
|
||||||
if (FormatTok->is(tok::l_brace)) {
|
if (FormatTok->is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
if (Style.BraceWrapping.BeforeCatch) {
|
if (Style.BraceWrapping.BeforeCatch) {
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2196,7 +2196,7 @@ void UnwrappedLineParser::parseTryCatch() {
|
||||||
}
|
}
|
||||||
NeedsUnwrappedLine = false;
|
NeedsUnwrappedLine = false;
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
if (Style.BraceWrapping.BeforeCatch)
|
if (Style.BraceWrapping.BeforeCatch)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
else
|
else
|
||||||
|
@ -2309,7 +2309,7 @@ void UnwrappedLineParser::parseForOrWhileLoop() {
|
||||||
parseParens();
|
parseParens();
|
||||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else {
|
} else {
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
|
@ -2324,7 +2324,7 @@ void UnwrappedLineParser::parseDoWhile() {
|
||||||
nextToken();
|
nextToken();
|
||||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
if (Style.BraceWrapping.BeforeWhile)
|
if (Style.BraceWrapping.BeforeWhile)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2363,7 +2363,7 @@ void UnwrappedLineParser::parseLabel(bool LeftAlignLabel) {
|
||||||
CompoundStatementIndenter Indenter(this, Line->Level,
|
CompoundStatementIndenter Indenter(this, Line->Level,
|
||||||
Style.BraceWrapping.AfterCaseLabel,
|
Style.BraceWrapping.AfterCaseLabel,
|
||||||
Style.BraceWrapping.IndentBraces);
|
Style.BraceWrapping.IndentBraces);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
if (FormatTok->Tok.is(tok::kw_break)) {
|
if (FormatTok->Tok.is(tok::kw_break)) {
|
||||||
if (Style.BraceWrapping.AfterControlStatement ==
|
if (Style.BraceWrapping.AfterControlStatement ==
|
||||||
FormatStyle::BWACS_Always) {
|
FormatStyle::BWACS_Always) {
|
||||||
|
@ -2405,7 +2405,7 @@ void UnwrappedLineParser::parseSwitch() {
|
||||||
parseParens();
|
parseParens();
|
||||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
CompoundStatementIndenter Indenter(this, Style, Line->Level);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else {
|
} else {
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
|
@ -2457,7 +2457,7 @@ void UnwrappedLineParser::parseRequiresExpression(unsigned int OriginalLevel) {
|
||||||
if (Style.BraceWrapping.AfterFunction)
|
if (Style.BraceWrapping.AfterFunction)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
FormatTok->setType(TT_FunctionLBrace);
|
FormatTok->setType(TT_FunctionLBrace);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else {
|
} else {
|
||||||
parseConstraintExpression(OriginalLevel);
|
parseConstraintExpression(OriginalLevel);
|
||||||
|
@ -2494,7 +2494,7 @@ void UnwrappedLineParser::parseConstraintExpression(
|
||||||
if (Style.BraceWrapping.AfterFunction)
|
if (Style.BraceWrapping.AfterFunction)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
FormatTok->setType(TT_FunctionLBrace);
|
FormatTok->setType(TT_FunctionLBrace);
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
}
|
}
|
||||||
if (FormatTok->Tok.is(tok::semi)) {
|
if (FormatTok->Tok.is(tok::semi)) {
|
||||||
// Eat any trailing semi.
|
// Eat any trailing semi.
|
||||||
|
@ -2834,7 +2834,7 @@ void UnwrappedLineParser::parseObjCMethod() {
|
||||||
} else if (FormatTok->Tok.is(tok::l_brace)) {
|
} else if (FormatTok->Tok.is(tok::l_brace)) {
|
||||||
if (Style.BraceWrapping.AfterFunction)
|
if (Style.BraceWrapping.AfterFunction)
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2863,7 +2863,7 @@ void UnwrappedLineParser::parseObjCUntilAtEnd() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (FormatTok->is(tok::l_brace)) {
|
if (FormatTok->is(tok::l_brace)) {
|
||||||
parseBlock(/*MustBeDeclaration=*/false);
|
parseBlock();
|
||||||
// In ObjC interfaces, nothing should be following the "}".
|
// In ObjC interfaces, nothing should be following the "}".
|
||||||
addUnwrappedLine();
|
addUnwrappedLine();
|
||||||
} else if (FormatTok->is(tok::r_brace)) {
|
} else if (FormatTok->is(tok::r_brace)) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ private:
|
||||||
void reset();
|
void reset();
|
||||||
void parseFile();
|
void parseFile();
|
||||||
void parseLevel(bool HasOpeningBrace);
|
void parseLevel(bool HasOpeningBrace);
|
||||||
void parseBlock(bool MustBeDeclaration, unsigned AddLevels = 1u,
|
void parseBlock(bool MustBeDeclaration = false, unsigned AddLevels = 1u,
|
||||||
bool MunchSemi = true,
|
bool MunchSemi = true,
|
||||||
bool UnindentWhitesmithsBraces = false);
|
bool UnindentWhitesmithsBraces = false);
|
||||||
void parseChildBlock();
|
void parseChildBlock();
|
||||||
|
|
Loading…
Reference in New Issue