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

Marcus Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 05:52:34 PDT 2020


MarcusJohnson91 added a comment.

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

>




> Something is not quite right here, this text isn't ending up in the ClangFormatStyleOptions.rst

You're right, I didn't catch that before, turns out having a comment before the variable is required for dump_format_style.py to work.

I've fixed this, I'm still working on the tests, and I'll clang-format the files when it's all done.

> Please clang-format the patch, I'm also getting a crash when running the tests, please make sure they pass.

I'm not sure why the tests crash, I know that when I manually test all the options for IndentExternBlock , and when testing IndentExternBlock: AfterExternBlock and setting BraceWrapping.AfterExternBlock, everything works.

i just get gibberish about loading the default LLVM style failed, and a nonsensical hex dump (0xFF 0xFE then a bunch of NULLs)

I honestly thought these crashes were unrelated.

----

> Please add yourself to the pre-merge testing project so your reviews get checked before updating the patch
> 
>   https://reviews.llvm.org/project/view/78/

When I go there and click Watch it says:

> You Shall Not Pass: #pre-merge_beta_testing <https://reviews.llvm.org/tag/pre-merge_beta_testing/>	
>  You do not have permission to edit this object.
>  Users with the "Can Edit" capability:
>  Administrators can take this action.



----

As for my testing, I'm doing both manual and autmoated testing, automated with `ninja check all`

and manual testing with main.c:

  #ifdef __cplusplus

extern "C" {
#endif

  void blah1(void);

#ifdef __cplusplus
}
#endif

extern "C++" {

  void blah2(void) {
      int one = 1;
  }

}

and here's the command line:

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: true}" /Users/Marcus/Desktop/Test_Clang-Format.c

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: false}" /Users/Marcus/Desktop/Test_Clang-Format.c

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: Indent}" /Users/Marcus/Desktop/Test_Clang-Format.c

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: NoIndent}" /Users/Marcus/Desktop/Test_Clang-Format.c

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: AfterExternBlock, BraceWrapping: {AfterExternBlock: false}}" /Users/Marcus/Desktop/Test_Clang-Format.c

~/Source/External/LLVM_BUILD/bin/clang-format -i -style="{IndentWidth: 4, IndentExternBlock: AfterExternBlock, BraceWrapping: {AfterExternBlock: true}}" /Users/Marcus/Desktop/Test_Clang-Format.c

tho now that I'm manually testing it again (I really only used manual testing to make sure the options were accepted, to iterate more quickly), it looks like the AfterExternBlock: true option isn't working, but false is.

if thats true how didn't the automated tests catch it?


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

https://reviews.llvm.org/D75791





More information about the cfe-commits mailing list