[clang] b908123 - [clang-format][NFC] Minor cleanup of token annotator and test cases

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 00:19:07 PDT 2023


Author: Owen Pan
Date: 2023-09-11T00:18:57-07:00
New Revision: b908123c3c1934c03b5183318a47d321fb796260

URL: https://github.com/llvm/llvm-project/commit/b908123c3c1934c03b5183318a47d321fb796260
DIFF: https://github.com/llvm/llvm-project/commit/b908123c3c1934c03b5183318a47d321fb796260.diff

LOG: [clang-format][NFC] Minor cleanup of token annotator and test cases

Added: 
    

Modified: 
    clang/lib/Format/TokenAnnotator.cpp
    clang/unittests/Format/FormatTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 2bb6565193cec83..e925bee44cd0c6a 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -137,7 +137,7 @@ class AnnotatingParser {
   bool parseAngle() {
     if (!CurrentToken || !CurrentToken->Previous)
       return false;
-    if (NonTemplateLess.count(CurrentToken->Previous))
+    if (NonTemplateLess.count(CurrentToken->Previous) > 0)
       return false;
 
     const FormatToken &Previous = *CurrentToken->Previous; // The '<'.

diff  --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 96c2dbf11eecdd4..4f72166bdce2d73 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -10656,8 +10656,8 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
   verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
                "      .template operator()<A>());",
                getLLVMStyleWithColumns(35));
-  verifyFormat("bool_constant<a && noexcept(f())>");
-  verifyFormat("bool_constant<a || noexcept(f())>");
+  verifyFormat("bool_constant<a && noexcept(f())>;");
+  verifyFormat("bool_constant<a || noexcept(f())>;");
 
   verifyFormat("if (std::tuple_size_v<T> > 0)");
 


        


More information about the cfe-commits mailing list