[clang] [clang-format] Adjust requires clause wrapping (#101550) (PR #102078)

Nathan Sidwell via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 10 09:57:33 PDT 2024


================
@@ -5682,12 +5683,15 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
            (Style.BreakTemplateDeclarations == FormatStyle::BTDS_Leave &&
             Right.NewlinesBefore > 0);
   }
-  if (Left.ClosesRequiresClause && Right.isNot(tok::semi) &&
-      Right.isNot(tok::l_brace)) {
+  if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) {
     switch (Style.RequiresClausePosition) {
     case FormatStyle::RCPS_OwnLine:
     case FormatStyle::RCPS_WithPreceding:
       return true;
+    case FormatStyle::RCPS_OwnLineWithBrace:
+      if (Right.isNot(tok::l_brace))
+        return true;
+      break;
----------------
urnathan wrote:

I originally made the return conditional to match the ';' control flow.  But sure, direct return in both cases works too.

https://github.com/llvm/llvm-project/pull/102078


More information about the cfe-commits mailing list