[clang] 38dd67c - [clang-format][NFC] Minor cleanup of the parser and annotator
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 25 22:20:09 PDT 2023
Author: Owen Pan
Date: 2023-09-25T22:20:02-07:00
New Revision: 38dd67c8b3dbce4311e32a68d1100bd9f850c43e
URL: https://github.com/llvm/llvm-project/commit/38dd67c8b3dbce4311e32a68d1100bd9f850c43e
DIFF: https://github.com/llvm/llvm-project/commit/38dd67c8b3dbce4311e32a68d1100bd9f850c43e.diff
LOG: [clang-format][NFC] Minor cleanup of the parser and annotator
Added:
Modified:
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 138f7e8562dcc39..5becb86c0f37081 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -4141,8 +4141,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
(Style.SpacesInSquareBrackets &&
Right.MatchingParen->isOneOf(TT_ArraySubscriptLSquare,
TT_StructuredBindingLSquare,
- TT_LambdaLSquare)) ||
- Right.MatchingParen->is(TT_AttributeParen));
+ TT_LambdaLSquare)));
}
if (Right.is(tok::l_square) &&
!Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare,
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 020ca3cff9bfbcd..53310d44c709af5 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2660,7 +2660,7 @@ void UnwrappedLineParser::handleAttributes() {
// Handle AttributeMacro, e.g. `if (x) UNLIKELY`.
if (FormatTok->is(TT_AttributeMacro))
nextToken();
- if (FormatTok->is(tok::l_square))
+ else if (FormatTok->is(tok::l_square))
handleCppAttributes();
}
More information about the cfe-commits
mailing list