[PATCH] D75791: [clang-format] Added new option IndentExternBlock

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 03:12:01 PDT 2020


MyDeveloperDay added a comment.

You need to regenerate the ClangFormatStyleOption.rst file using docs/tools/dump_format_style.py



================
Comment at: clang/include/clang/Format/Format.h:965
     bool AfterExternBlock;
+    enum ExternBlock {
+      /// Break extern blocks before the curly brace.
----------------
I'm a little confused here by the use of this enum, can't it be removed now?


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1117
           addUnwrappedLine();
-          parseBlock(/*MustBeDeclaration=*/true);
+          parseBlock(/*MustBeDeclaration=*/true, /*AddLevel=*/Style.BraceWrapping.AfterExternBlock == true ? true : false);
         } else {
----------------
can't you just use?

```
parseBlock(/*MustBeDeclaration=*/true, /*AddLevel=*/Style.BraceWrapping.AfterExternBlock);
```


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1119
         } else {
-          parseBlock(/*MustBeDeclaration=*/true, /*AddLevel=*/false);
+          parseBlock(/*MustBeDeclaration=*/true, /*AddLevel=*/Style.IndentExternBlock == FormatStyle::IEBS_Indent ? true : false);
         }
----------------
```
parseBlock(/*MustBeDeclaration=*/true, /*AddLevel=*/Style.IndentExternBlock == FormatStyle::IEBS_Indent)
```


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

https://reviews.llvm.org/D75791





More information about the cfe-commits mailing list