[clang] 326cb51 - [clang-format] Simplify conditions in spaceRequiredBetween. NFC.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 11 03:02:59 PST 2022
Author: Marek Kurdej
Date: 2022-02-11T12:01:24+01:00
New Revision: 326cb51b147a1de17ba0157c41c37243d3cbc0ff
URL: https://github.com/llvm/llvm-project/commit/326cb51b147a1de17ba0157c41c37243d3cbc0ff
DIFF: https://github.com/llvm/llvm-project/commit/326cb51b147a1de17ba0157c41c37243d3cbc0ff.diff
LOG: [clang-format] Simplify conditions in spaceRequiredBetween. NFC.
Added:
Modified:
clang/lib/Format/TokenAnnotator.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 28b244b9c59f1..ef4ce3483fcff 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3093,14 +3093,15 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
Right.Next->is(TT_RangeBasedForLoopColon))
return getTokenPointerOrReferenceAlignment(Left) !=
FormatStyle::PAS_Right;
- return !Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
- tok::l_paren) &&
- (getTokenPointerOrReferenceAlignment(Left) !=
- FormatStyle::PAS_Right &&
- !Line.IsMultiVariableDeclStmt) &&
- Left.Previous &&
- !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon,
- tok::l_square);
+ if (Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
+ tok::l_paren))
+ return false;
+ if (getTokenPointerOrReferenceAlignment(Left) == FormatStyle::PAS_Right)
+ return false;
+ if (Line.IsMultiVariableDeclStmt)
+ return false;
+ return Left.Previous && !Left.Previous->isOneOf(
+ tok::l_paren, tok::coloncolon, tok::l_square);
}
// Ensure right pointer alignment with ellipsis e.g. int *...P
if (Left.is(tok::ellipsis) && Left.Previous &&
More information about the cfe-commits
mailing list