mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-15 04:00:56 +00:00
Run clang-format on lib/Format code after r184894. No other changes.
llvm-svn: 184896
This commit is contained in:
parent
fa95cc916f
commit
9096fc0dab
@ -266,8 +266,8 @@ public:
|
||||
State.Column = FirstIndent;
|
||||
State.NextToken = RootToken;
|
||||
State.Stack.push_back(
|
||||
ParenState(FirstIndent, FirstIndent, /*AvoidBinPacking=*/ false,
|
||||
/*NoLineBreak=*/ false));
|
||||
ParenState(FirstIndent, FirstIndent, /*AvoidBinPacking=*/false,
|
||||
/*NoLineBreak=*/false));
|
||||
State.LineContainsContinuedForLoopSection = false;
|
||||
State.ParenLevel = 0;
|
||||
State.StartOfStringLiteral = 0;
|
||||
@ -276,7 +276,7 @@ public:
|
||||
State.IgnoreStackForComparison = false;
|
||||
|
||||
// The first token has already been indented and thus consumed.
|
||||
moveStateToNextToken(State, /*DryRun=*/ false);
|
||||
moveStateToNextToken(State, /*DryRun=*/false);
|
||||
|
||||
// If everything fits on a single line, just put it there.
|
||||
unsigned ColumnLimit = Style.ColumnLimit;
|
||||
@ -955,8 +955,8 @@ private:
|
||||
// State already examined with lower penalty.
|
||||
continue;
|
||||
|
||||
addNextStateToQueue(Penalty, Node, /*NewLine=*/ false);
|
||||
addNextStateToQueue(Penalty, Node, /*NewLine=*/ true);
|
||||
addNextStateToQueue(Penalty, Node, /*NewLine=*/false);
|
||||
addNextStateToQueue(Penalty, Node, /*NewLine=*/true);
|
||||
}
|
||||
|
||||
if (Queue.empty())
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
AnnotatingParser(AnnotatedLine &Line, IdentifierInfo &Ident_in)
|
||||
: Line(Line), CurrentToken(Line.First), KeywordVirtualFound(false),
|
||||
NameFound(false), Ident_in(Ident_in) {
|
||||
Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/ false));
|
||||
Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -315,7 +315,7 @@ private:
|
||||
case tok::kw_while:
|
||||
if (CurrentToken != NULL && CurrentToken->is(tok::l_paren)) {
|
||||
next();
|
||||
if (!parseParens(/*LookForDecls=*/ true))
|
||||
if (!parseParens(/*LookForDecls=*/true))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -200,7 +200,7 @@ void UnwrappedLineParser::parseFile() {
|
||||
ScopedDeclarationState DeclarationState(
|
||||
*Line, DeclarationScopeStack,
|
||||
/*MustBeDeclaration=*/ !Line->InPPDirective);
|
||||
parseLevel(/*HasOpeningBrace=*/ false);
|
||||
parseLevel(/*HasOpeningBrace=*/false);
|
||||
// Make sure to format the remaining tokens.
|
||||
flushComments(true);
|
||||
addUnwrappedLine();
|
||||
@ -216,7 +216,7 @@ void UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
|
||||
case tok::l_brace:
|
||||
// FIXME: Add parameter whether this can happen - if this happens, we must
|
||||
// be in a non-declaration context.
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
addUnwrappedLine();
|
||||
break;
|
||||
case tok::r_brace:
|
||||
@ -305,7 +305,7 @@ void UnwrappedLineParser::parseBlock(bool MustBeDeclaration,
|
||||
ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack,
|
||||
MustBeDeclaration);
|
||||
Line->Level += AddLevels;
|
||||
parseLevel(/*HasOpeningBrace=*/ true);
|
||||
parseLevel(/*HasOpeningBrace=*/true);
|
||||
|
||||
if (!FormatTok->Tok.is(tok::r_brace)) {
|
||||
Line->Level -= AddLevels;
|
||||
@ -525,7 +525,7 @@ void UnwrappedLineParser::parseStructuralElement() {
|
||||
if (FormatTok->Tok.is(tok::string_literal)) {
|
||||
nextToken();
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ true, 0);
|
||||
parseBlock(/*MustBeDeclaration=*/true, 0);
|
||||
addUnwrappedLine();
|
||||
return;
|
||||
}
|
||||
@ -571,7 +571,7 @@ void UnwrappedLineParser::parseStructuralElement() {
|
||||
if (Style.BreakBeforeBraces == FormatStyle::BS_Linux ||
|
||||
Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup)
|
||||
addUnwrappedLine();
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
addUnwrappedLine();
|
||||
return;
|
||||
}
|
||||
@ -706,9 +706,9 @@ void UnwrappedLineParser::parseParens() {
|
||||
{
|
||||
ScopedLineState LineState(*this);
|
||||
ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack,
|
||||
/*MustBeDeclaration=*/ false);
|
||||
/*MustBeDeclaration=*/false);
|
||||
Line->Level += 1;
|
||||
parseLevel(/*HasOpeningBrace=*/ true);
|
||||
parseLevel(/*HasOpeningBrace=*/true);
|
||||
Line->Level -= 1;
|
||||
}
|
||||
nextToken();
|
||||
@ -734,7 +734,7 @@ void UnwrappedLineParser::parseIfThenElse() {
|
||||
parseParens();
|
||||
bool NeedsUnwrappedLine = false;
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
NeedsUnwrappedLine = true;
|
||||
} else {
|
||||
addUnwrappedLine();
|
||||
@ -745,7 +745,7 @@ void UnwrappedLineParser::parseIfThenElse() {
|
||||
if (FormatTok->Tok.is(tok::kw_else)) {
|
||||
nextToken();
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
addUnwrappedLine();
|
||||
} else if (FormatTok->Tok.is(tok::kw_if)) {
|
||||
parseIfThenElse();
|
||||
@ -769,7 +769,7 @@ void UnwrappedLineParser::parseNamespace() {
|
||||
if (Style.BreakBeforeBraces == FormatStyle::BS_Linux)
|
||||
addUnwrappedLine();
|
||||
|
||||
parseBlock(/*MustBeDeclaration=*/ true, 0);
|
||||
parseBlock(/*MustBeDeclaration=*/true, 0);
|
||||
// Munch the semicolon after a namespace. This is more common than one would
|
||||
// think. Puttin the semicolon into its own line is very ugly.
|
||||
if (FormatTok->Tok.is(tok::semi))
|
||||
@ -786,7 +786,7 @@ void UnwrappedLineParser::parseForOrWhileLoop() {
|
||||
if (FormatTok->Tok.is(tok::l_paren))
|
||||
parseParens();
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
addUnwrappedLine();
|
||||
} else {
|
||||
addUnwrappedLine();
|
||||
@ -800,7 +800,7 @@ void UnwrappedLineParser::parseDoWhile() {
|
||||
assert(FormatTok->Tok.is(tok::kw_do) && "'do' expected");
|
||||
nextToken();
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
} else {
|
||||
addUnwrappedLine();
|
||||
++Line->Level;
|
||||
@ -826,7 +826,7 @@ void UnwrappedLineParser::parseLabel() {
|
||||
if (Line->Level > 1 || (!Line->InPPDirective && Line->Level > 0))
|
||||
--Line->Level;
|
||||
if (CommentsBeforeNextToken.empty() && FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false);
|
||||
parseBlock(/*MustBeDeclaration=*/false);
|
||||
if (FormatTok->Tok.is(tok::kw_break))
|
||||
parseStructuralElement(); // "break;" after "}" goes on the same line.
|
||||
}
|
||||
@ -849,7 +849,7 @@ void UnwrappedLineParser::parseSwitch() {
|
||||
if (FormatTok->Tok.is(tok::l_paren))
|
||||
parseParens();
|
||||
if (FormatTok->Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ false, Style.IndentCaseLabels ? 2 : 1);
|
||||
parseBlock(/*MustBeDeclaration=*/false, Style.IndentCaseLabels ? 2 : 1);
|
||||
addUnwrappedLine();
|
||||
} else {
|
||||
addUnwrappedLine();
|
||||
@ -948,7 +948,7 @@ void UnwrappedLineParser::parseRecord() {
|
||||
if (Style.BreakBeforeBraces == FormatStyle::BS_Linux)
|
||||
addUnwrappedLine();
|
||||
|
||||
parseBlock(/*MustBeDeclaration=*/ true);
|
||||
parseBlock(/*MustBeDeclaration=*/true);
|
||||
}
|
||||
// We fall through to parsing a structural element afterwards, so
|
||||
// class A {} n, m;
|
||||
@ -991,7 +991,7 @@ void UnwrappedLineParser::parseObjCInterfaceOrImplementation() {
|
||||
|
||||
// If instance variables are present, keep the '{' on the first line too.
|
||||
if (FormatTok->Tok.is(tok::l_brace))
|
||||
parseBlock(/*MustBeDeclaration=*/ true);
|
||||
parseBlock(/*MustBeDeclaration=*/true);
|
||||
|
||||
// With instance variables, this puts '}' on its own line. Without instance
|
||||
// variables, this ends the @interface line.
|
||||
@ -1027,7 +1027,6 @@ void UnwrappedLineParser::addUnwrappedLine() {
|
||||
E = Line->Tokens.end();
|
||||
I != E; ++I) {
|
||||
llvm::dbgs() << (*I)->Tok.getName() << " ";
|
||||
|
||||
}
|
||||
llvm::dbgs() << "\n";
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user