[clang] 8712ed5 - [clang-format][NFC] Call eof() and isEOF() in UnwrappedLineParser
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 25 22:07:18 PDT 2022
Author: owenca
Date: 2022-08-25T22:07:03-07:00
New Revision: 8712ed5af1117f079be06780e9c77815d1876af2
URL: https://github.com/llvm/llvm-project/commit/8712ed5af1117f079be06780e9c77815d1876af2
DIFF: https://github.com/llvm/llvm-project/commit/8712ed5af1117f079be06780e9c77815d1876af2.diff
LOG: [clang-format][NFC] Call eof() and isEOF() in UnwrappedLineParser
Added:
Modified:
clang/lib/Format/UnwrappedLineParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 640ae6b5fa8ae..7518fd36d2534 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -245,7 +245,7 @@ class IndexedTokenSource : public FormatTokenSource {
: Tokens(Tokens), Position(-1) {}
FormatToken *getNextToken() override {
- if (Position >= 0 && Tokens[Position]->is(tok::eof)) {
+ if (Position >= 0 && isEOF()) {
LLVM_DEBUG({
llvm::dbgs() << "Next ";
dbgToken(Position);
@@ -1494,7 +1494,7 @@ void UnwrappedLineParser::parseStructuralElement(
if (FormatTok->is(tok::l_brace)) {
FormatTok->setFinalizedType(TT_InlineASMBrace);
nextToken();
- while (FormatTok && FormatTok->isNot(tok::eof)) {
+ while (FormatTok && !eof()) {
if (FormatTok->is(tok::r_brace)) {
FormatTok->setFinalizedType(TT_InlineASMBrace);
nextToken();
@@ -1835,7 +1835,7 @@ void UnwrappedLineParser::parseStructuralElement(
parseParens();
// Break the unwrapped line if a K&R C function definition has a parameter
// declaration.
- if (!IsTopLevel || !Style.isCpp() || !Previous || FormatTok->is(tok::eof))
+ if (!IsTopLevel || !Style.isCpp() || !Previous || eof())
break;
if (isC78ParameterDecl(FormatTok, Tokens->peekNextToken(), Previous)) {
addUnwrappedLine();
@@ -2629,7 +2629,7 @@ void UnwrappedLineParser::parseUnbracedBody(bool CheckEOF) {
++Tok->BraceCount;
}
- if (CheckEOF && FormatTok->is(tok::eof))
+ if (CheckEOF && eof())
addUnwrappedLine();
--Line->Level;
@@ -3738,7 +3738,7 @@ void UnwrappedLineParser::parseJavaEnumBody() {
++Line->Level;
// Parse the enum constants.
- while (FormatTok->isNot(tok::eof)) {
+ while (!eof()) {
if (FormatTok->is(tok::l_brace)) {
// Parse the constant's class body.
parseBlock(/*MustBeDeclaration=*/true, /*AddLevels=*/1u,
More information about the cfe-commits
mailing list