[PATCH] D82181: [clang-format] indent in chained conditionals when AlignOperands:DontAlign

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 19 06:59:30 PDT 2020


krasimir created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

TODO


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82181

Files:
  clang/lib/Format/ContinuationIndenter.cpp


Index: clang/lib/Format/ContinuationIndenter.cpp
===================================================================
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -1041,8 +1041,10 @@
       //    * not remove the 'lead' ContinuationIndentWidth
       //    * always un-indent by the operator when
       //    BreakBeforeTernaryOperators=true
-      unsigned Indent =
-          State.Stack.back().Indent - Style.ContinuationIndentWidth;
+      unsigned Indent = State.Stack.back().Indent;
+      if (Style.AlignOperands != FormatStyle::OAS_DontAlign) {
+        Indent -= Style.ContinuationIndentWidth;
+      }
       if (Style.BreakBeforeTernaryOperators &&
           State.Stack.back().UnindentOperator)
         Indent -= 2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82181.272048.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200619/1fd84712/attachment.bin>


More information about the cfe-commits mailing list