<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58161>58161</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
git-clang-format doesn't insert closing braces
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format,
invalid-code-generation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
owenca
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
owenca
</td>
</tr>
</table>
<pre>
```
$ cd ~/llvm-project
$ clang-format -version
clang-format version 16.0.0 (https://github.com/llvm/llvm-project b60e7a7f1afc45af5a6ca9fc8a531c41d0e93c85)
$ git diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 597d7b64625f..6e7a24ab2893 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -88,7 +88,7 @@ public:
private:
bool parseAngle() {
- if (!CurrentToken || !CurrentToken->Previous)
+ if (!(CurrentToken && CurrentToken->Previous))
return false;
if (NonTemplateLess.count(CurrentToken->Previous))
return false;
$ git-clang-format --diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 6e7a24ab2893..69594ebf6772 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -88,7 +88,7 @@ public:
private:
bool parseAngle() {
- if (!(CurrentToken && CurrentToken->Previous))
+ if (!(CurrentToken && CurrentToken->Previous)) {
return false;
if (NonTemplateLess.count(CurrentToken->Previous))
return false;
@@ -194,7 +194,7 @@ private:
return false;
}
return false;
- }
+ }
bool parseUntouchableParens() {
while (CurrentToken) {
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlVU1vnDAQ_TVwsUBgwOADh2ySPVVVDukPMDDedeu1V7bZtP--s0C6H4laJa2UQ1cjMDOzM-_5jeXODj_aiGWLZXdRdhPRkvQDier7iK61PuySvbNfoQ9nYS3MJpHW7UQgyQGcV9bM4YvQEiE5S7M0IxFttiHsfVRglTXaRoXt2KW93S2trjqSjmVQi1rmQvZlJWQlWC-47BtRFXlf5kMGvOibKqL8hA6rkkFJOXuOK5IkR6fA8hO-YxvV4XM94cTFo_0G5sYYG0SwLu33e9K9JXvupcwA30nF66HuWMloJdOUIQFaio42vCB5lrGynJOTJHkbomeGq9neAzAqMzSSNE1Eb2sUZPW8mgP7sdOqP-ozpZPltXfqIAKc_IR01mqyF87DjdloQGlRAxya1UIOU4iSZPLnt6NzYMKECnNu0ciVO4mK-wcHB2VHf6bm6qIOPi9LUYZGflfnuRSZfw7C6AyRQnukszqLzU0-W_MIu71Gtp_AexzN0YSrtu9pscxlcnlyko8c0_PBxDHlFS-hk6yu6f86pn8xXv9kUk-4Pnpal_3PefkswK_losDLrf4T5Ki-O_t6NS85y1p29PSvVzT9YoId-63oNDwIZOyv9Z1aPW2VBnK1LRdpv27AGNqcsZKzrKiaeGiLgRdcxEEFDe2L8ztY8FioDkQZDy7gvWi9MhvSOdGDj0en27ddePipvB8BiayrJmd5vG1lU3LBc1aIoaqyEnguJc06Snmf815CrEUH2rdRhceNngPET9QMmVNlDkKrIentAMkGDDgRjlc2JlR3sWppRike-iprKp7XaSEryQpJWcFqAaxExWEnlE6PWFPrNrFrJ9jduPEY1MoHfwoK79XGACyQ7BOYXiy9xBi21rWzL57IthPTn_SEhAg">