[clang] [clang-format][NFC] Reduce indent (PR #70583)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 28 23:22:48 PDT 2023
https://github.com/HazardyKnusperkeks updated https://github.com/llvm/llvm-project/pull/70583
>From ad595c32b08bb4d9ddbe2361da86491dbe3c09e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern at hazardy.de>
Date: Sun, 29 Oct 2023 07:18:06 +0100
Subject: [PATCH] [clang-format][NFC] Reduce indent
By using if init statement.
---
clang/lib/Format/TokenAnnotator.cpp | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
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