[PATCH] D110833: [clang-format] Refactor SpaceBeforeParens to add options

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 29 01:00:53 PST 2021


MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3161-3169
+    if (Line.MightBeFunctionDecl && (Left.is(TT_FunctionDeclarationName) ||
+                                     Right.is(TT_OverloadedOperatorLParen))) {
+      if (Line.mightBeFunctionDefinition())
+        return Style.SpaceBeforeParensOptions.AfterFunctionDefinitionName ||
+               spaceRequiredBeforeParens(Right);
+      else
+        return Style.SpaceBeforeParensOptions.AfterFunctionDeclarationName ||
----------------
This is a change in behaviour for operators, it breaks LLVM style and we are going to either have to fix this or revert the whole change until we can decide what is best.


================
Comment at: clang/unittests/Format/FormatTest.cpp:14165
+  SpaceFuncDecl.SpaceBeforeParens = FormatStyle::SBPO_Custom;
+  SpaceFuncDecl.SpaceBeforeParensOptions.AfterFunctionDeclarationName = true;
+
----------------
are you testing the -ve case anywhere?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110833/new/

https://reviews.llvm.org/D110833



More information about the cfe-commits mailing list