[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-29 Thread Björn Schäpers via cfe-commits

https://github.com/HazardyKnusperkeks closed 
https://github.com/llvm/llvm-project/pull/70583
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread Owen Pan via cfe-commits

https://github.com/owenca approved this pull request.


https://github.com/llvm/llvm-project/pull/70583
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread Björn Schäpers via cfe-commits

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?= 
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);
   }
 }
   }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Björn Schäpers (HazardyKnusperkeks)


Changes

By using if init statement.

---
Full diff: https://github.com/llvm/llvm-project/pull/70583.diff


1 Files Affected:

- (modified) clang/lib/Format/TokenAnnotator.cpp (+10-12) 


``diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 9ec8b93e39fd23a..eda312689f3ce4a 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->isNot(tok::caret)) {
+  // Make sure this isn't the return type of an Obj-C block 
declaration.
+  if (FormatToken *BeforeParen = Current.MatchingParen->Previous;
+  BeforeParen->is(tok::identifier) &&
+  BeforeParen->isNot(TT_TypenameMacro) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration)) {
+Current.setType(TT_FunctionAnnotationRParen);
   }
 }
   }

``




https://github.com/llvm/llvm-project/pull/70583
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format][NFC] Reduce indent (PR #70583)

2023-10-28 Thread Björn Schäpers via cfe-commits

https://github.com/HazardyKnusperkeks created 
https://github.com/llvm/llvm-project/pull/70583

By using if init statement.

From b1af9c060cc5dca1f3bbc551d6a77e73451ffa06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= 
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..eda312689f3ce4a 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->isNot(tok::caret)) {
+  // Make sure this isn't the return type of an Obj-C block 
declaration.
+  if (FormatToken *BeforeParen = Current.MatchingParen->Previous;
+  BeforeParen->is(tok::identifier) &&
+  BeforeParen->isNot(TT_TypenameMacro) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration)) {
+Current.setType(TT_FunctionAnnotationRParen);
   }
 }
   }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits