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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 08:01:58 PDT 2020


MyDeveloperDay added a comment.

I've added you to https://reviews.llvm.org/project/view/78/



================
Comment at: clang/include/clang/Format/Format.h:1555
+  IndentExternBlockStyle IndentExternBlock;
+
   /// A vector of prefixes ordered by the desired groups for Java imports.
----------------
MyDeveloperDay wrote:
> Something is not quie right here, this text isn't ending up in the ClangFormatStyleOptions.rst
you need to add a comment before the actual variable (you can use your own choice of text)

```
/// Option to control indenting of code inside an extern block
IndentExternBlockStyle IndentExternBlock;
```

Doing so will pull in the enum values into the ClangFormatStyleOptions.rst when running the docs/tools/dump_format_style.py and you'll get a different diff

```
-  * ``bool AfterExternBlock`` Wrap extern blocks.
+  * ``bool AfterExternBlock`` Wrap extern blocks; Partially superseded by IndentExternBlock

     .. code-block:: c++

@@ -1680,6 +1680,49 @@ the configuration (without a prefix: ``Auto``).
        plop();                                  plop();
      }                                      }

+**IndentExternBlock** (``IndentExternBlockStyle``)
+  Option to control indenting of code inside an extern block
+
+  Possible values:
+
+  * ``IEBS_NoIndent`` (in configuration: ``NoIndent``)
+    Does not indent extern blocks.
+
+    .. code-block:: c++
+
+     extern "C" {
+     void foo();
+     }
+
+  * ``IEBS_Indent`` (in configuration: ``Indent``)
+    Indents extern blocks.
+
+    .. code-block:: c++
+
+     extern "C" {
+       void foo();
+     }
+
+  * ``IEBS_AfterExternBlock`` (in configuration: ``AfterExternBlock``)
+    Backwards compatible with AfterExternBlock's indenting.
+    AfterExternBlock: true
+
+    .. code-block:: c++
+
+    extern "C"
+    {
+      void foo();
+    }
+    AfterExternBlock: false
+
+    .. code-block:: c++
+
+    extern "C" {
+    void foo();
+    }
+
+
+
 **IndentGotoLabels** (``bool``)
   Indent goto labels.
```






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

https://reviews.llvm.org/D75791





More information about the cfe-commits mailing list