[clang] [clang-format] Add an option to control indentation of `export { ... }` (PR #110381)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 11:31:16 PDT 2024


================
@@ -3107,29 +3131,15 @@ void UnwrappedLineParser::parseNamespace() {
                  DeclarationScopeStack.size() > 1)
             ? 1u
             : 0u;
-    bool ManageWhitesmithsBraces =
-        AddLevels == 0u &&
-        Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths;
-
-    // If we're in Whitesmiths mode, indent the brace if we're not indenting
-    // the whole block.
-    if (ManageWhitesmithsBraces)
-      ++Line->Level;
-
-    // Munch the semicolon after a namespace. This is more common than one would
-    // think. Putting the semicolon into its own line is very ugly.
-    parseBlock(/*MustBeDeclaration=*/true, AddLevels, /*MunchSemi=*/true,
-               /*KeepBraces=*/true, /*IfKind=*/nullptr,
-               ManageWhitesmithsBraces);
-
-    addUnwrappedLine(AddLevels > 0 ? LineLevel::Remove : LineLevel::Keep);
-
-    if (ManageWhitesmithsBraces)
-      --Line->Level;
+    parseNamespaceOrExportBlock(AddLevels);
   }
   // FIXME: Add error handling.
 }
 
+void UnwrappedLineParser::parseCXXExportBlock() {
+  parseNamespaceOrExportBlock(Style.ExportBlockIndentation ? 1 : 0);
----------------
HazardyKnusperkeks wrote:

```suggestion
  parseNamespaceOrExportBlock(/*AddLevels=*/Style.ExportBlockIndentation ? 1 : 0);
```

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


More information about the cfe-commits mailing list