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

Marcus Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 13:35:19 PDT 2020


MarcusJohnson91 added a comment.

In D75791#1917837 <https://reviews.llvm.org/D75791#1917837>, @MyDeveloperDay wrote:

> your patch seems to be missing the other files


Which other files? I made a new commit and did the full context diff, now sure why it's only showing the documentation update.

I've never committed to Clang before, I don't know this process exactly.



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1088
       if (FormatTok->Tok.is(tok::l_brace)) {
-        if (Style.BraceWrapping.AfterExternBlock) {
-          parseBlock(/*MustBeDeclaration=*/true);
-        } else {
+        if (Style.BraceWrapping.AfterExternBlock == true &&
+            Style.IndentExternBlock == true) {
----------------
MyDeveloperDay wrote:
> something here looks abit odd? there is too much repetition around you option, I think you doing something at the wrong level.
I agree that the parseBlock function is doing too much, but it's written that way to begin with.

The parseBlock function takes 3 parameters and has defaults for two of them, I just changed the value for those defaults on the IndentExternBlock == false versions to default to not indenting; that way the AfterExternBlock option only handles bracewrapping extern blocks, without indenting as well.


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

https://reviews.llvm.org/D75791





More information about the cfe-commits mailing list