[clang] 91b9a66 - [clang-format][NFC] Reduce indent
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 29 12:55:15 PDT 2023
Author: Björn Schäpers
Date: 2023-10-29T20:55:12+01:00
New Revision: 91b9a661c21891dc06e1721a26478d5bfe53e4ed
URL: https://github.com/llvm/llvm-project/commit/91b9a661c21891dc06e1721a26478d5bfe53e4ed
DIFF: https://github.com/llvm/llvm-project/commit/91b9a661c21891dc06e1721a26478d5bfe53e4ed.diff
LOG: [clang-format][NFC] Reduce indent
By using if init statement.
Added:
Modified:
clang/lib/Format/TokenAnnotator.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 9ec8b93e39fd23a..aee966145b8e518 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2093,18 +2093,16 @@ class AnnotatingParser {
!Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace,
tok::comma, tok::period, tok::arrow,
tok::coloncolon, tok::kw_noexcept)) {
- if (FormatToken *AfterParen = Current.MatchingParen->Next) {
- // Make sure this isn't the return type of an Obj-C block declaration
- if (AfterParen->isNot(tok::caret)) {
- if (FormatToken *BeforeParen = Current.MatchingParen->Previous) {
- if (BeforeParen->is(tok::identifier) &&
- BeforeParen->isNot(TT_TypenameMacro) &&
- BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
- (!BeforeParen->Previous ||
- BeforeParen->Previous->ClosesTemplateDeclaration)) {
- Current.setType(TT_FunctionAnnotationRParen);
- }
- }
+ if (FormatToken *AfterParen = Current.MatchingParen->Next;
+ AfterParen && AfterParen->isNot(tok::caret)) {
+ // Make sure this isn't the return type of an Obj-C block declaration.
+ if (FormatToken *BeforeParen = Current.MatchingParen->Previous;
+ BeforeParen && BeforeParen->is(tok::identifier) &&
+ BeforeParen->isNot(TT_TypenameMacro) &&
+ BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+ (!BeforeParen->Previous ||
+ BeforeParen->Previous->ClosesTemplateDeclaration)) {
+ Current.setType(TT_FunctionAnnotationRParen);
}
}
}
More information about the cfe-commits
mailing list