Skip to content

Commit a6ccda2

Browse files
committed
[clang-format][NFC] Use better names for a couple of data members
1 parent c861c1a commit a6ccda2

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
629629
!Style.isJavaScript() && Previous.isNot(tok::kw_template) &&
630630
CurrentState.BreakBeforeParameter) {
631631
for (const auto *Tok = &Previous; Tok; Tok = Tok->Previous)
632-
if (Tok->FirstAfterPPDirectiveLine || Tok->is(TT_LineComment))
632+
if (Tok->FirstAfterPPLine || Tok->is(TT_LineComment))
633633
return false;
634634

635635
return true;

clang/lib/Format/FormatToken.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,8 @@ struct FormatToken {
594594
/// Has "\n\f\n" or "\n\f\r\n" before TokenText.
595595
bool HasFormFeedBefore = false;
596596

597-
/// Is the first token after a PPDirective line.
598-
bool FirstAfterPPDirectiveLine = false;
597+
/// Is the first token after a preprocessor line.
598+
bool FirstAfterPPLine = false;
599599

600600
/// Number of optional braces to be inserted after this token:
601601
/// -1: a single left brace

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class ScopedLineState {
119119
assert(Parser.Line->Tokens.empty());
120120
Parser.Line = std::move(PreBlockLine);
121121
if (Parser.CurrentLines == &Parser.PreprocessorDirectives)
122-
Parser.MustBreakBeforeNextToken = true;
122+
Parser.AtEndOfPPLine = true;
123123
Parser.CurrentLines = OriginalLines;
124124
}
125125

@@ -158,8 +158,8 @@ UnwrappedLineParser::UnwrappedLineParser(
158158
ArrayRef<FormatToken *> Tokens, UnwrappedLineConsumer &Callback,
159159
llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
160160
IdentifierTable &IdentTable)
161-
: Line(new UnwrappedLine), MustBreakBeforeNextToken(false),
162-
CurrentLines(&Lines), Style(Style), IsCpp(Style.isCpp()),
161+
: Line(new UnwrappedLine), AtEndOfPPLine(false), CurrentLines(&Lines),
162+
Style(Style), IsCpp(Style.isCpp()),
163163
LangOpts(getFormattingLangOpts(Style)), Keywords(Keywords),
164164
CommentPragmasRegex(Style.CommentPragmas), Tokens(nullptr),
165165
Callback(Callback), AllTokens(Tokens), PPBranchLevel(-1),
@@ -180,7 +180,7 @@ void UnwrappedLineParser::reset() {
180180
Line.reset(new UnwrappedLine);
181181
CommentsBeforeNextToken.clear();
182182
FormatTok = nullptr;
183-
MustBreakBeforeNextToken = false;
183+
AtEndOfPPLine = false;
184184
IsDecltypeAutoFunction = false;
185185
PreprocessorDirectives.clear();
186186
CurrentLines = &Lines;
@@ -5090,12 +5090,12 @@ UnwrappedLineParser::parseMacroCall() {
50905090

50915091
void UnwrappedLineParser::pushToken(FormatToken *Tok) {
50925092
Line->Tokens.push_back(UnwrappedLineNode(Tok));
5093-
if (MustBreakBeforeNextToken) {
5093+
if (AtEndOfPPLine) {
50945094
auto &Tok = *Line->Tokens.back().Tok;
50955095
Tok.MustBreakBefore = true;
50965096
Tok.MustBreakBeforeFinalized = true;
5097-
Tok.FirstAfterPPDirectiveLine = true;
5098-
MustBreakBeforeNextToken = false;
5097+
Tok.FirstAfterPPLine = true;
5098+
AtEndOfPPLine = false;
50995099
}
51005100
}
51015101

clang/lib/Format/UnwrappedLineParser.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,11 @@ class UnwrappedLineParser {
298298
// Since the next token might already be in a new unwrapped line, we need to
299299
// store the comments belonging to that token.
300300
SmallVector<FormatToken *, 1> CommentsBeforeNextToken;
301+
301302
FormatToken *FormatTok = nullptr;
302-
bool MustBreakBeforeNextToken;
303+
304+
// Has just finished parsing a preprocessor line.
305+
bool AtEndOfPPLine;
303306

304307
// The parsed lines. Only added to through \c CurrentLines.
305308
SmallVector<UnwrappedLine, 8> Lines;

0 commit comments

Comments
 (0)