Issue 58161
Summary git-clang-format doesn't insert closing braces
Labels clang-format, invalid-code-generation
Assignees owenca
Reporter owenca
    ```
$ 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) {
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to