HazardyKnusperkeks created this revision.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, owenpan, MyDeveloperDay.
HazardyKnusperkeks requested review of this revision.

This fixes https://github.com/llvm/llvm-project/issues/64928.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158945

Files:
  clang/lib/Format/WhitespaceManager.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -18726,6 +18726,13 @@
                "                    {a_longer_name_for_wrap,\n"
                "                     a_longer_name_for_wrap}};",
                Alignment);
+
+  Alignment.ColumnLimit = 60;
+  verifyFormat("using II = typename TI<T, std::tuple<Types...>>::I;\n"
+               "using I  = std::conditional_t<II::value >= 0,\n"
+               "                              std::ic<int, II::value + 1>,\n"
+               "                              std::ic<int, -1>>;",
+               Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveBitFields) {
Index: clang/lib/Format/WhitespaceManager.cpp
===================================================================
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -425,6 +425,10 @@
           return true;
         }
 
+        // Continued template parameter.
+        if (Changes[ScopeStart - 1].Tok->is(TT_TemplateOpener))
+          return true;
+
         return false;
       };
 


Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -18726,6 +18726,13 @@
                "                    {a_longer_name_for_wrap,\n"
                "                     a_longer_name_for_wrap}};",
                Alignment);
+
+  Alignment.ColumnLimit = 60;
+  verifyFormat("using II = typename TI<T, std::tuple<Types...>>::I;\n"
+               "using I  = std::conditional_t<II::value >= 0,\n"
+               "                              std::ic<int, II::value + 1>,\n"
+               "                              std::ic<int, -1>>;",
+               Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveBitFields) {
Index: clang/lib/Format/WhitespaceManager.cpp
===================================================================
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -425,6 +425,10 @@
           return true;
         }
 
+        // Continued template parameter.
+        if (Changes[ScopeStart - 1].Tok->is(TT_TemplateOpener))
+          return true;
+
         return false;
       };
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to