[PATCH] D75791: [clang-format] Added new option IndentExternBlock
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 24 02:07:51 PDT 2020
MyDeveloperDay added inline comments.
================
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) {
----------------
MarcusJohnson91 wrote:
> 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.
I still feel this blocks of 4 if can be written better, its making my eyes hurt, every if calls parseBlock() with either true.true, of true,false
I feel it could be something like
```
if (Style.BraceWrapping.AfterExternBlock){
addUnwrappedLine()
}
parseBlock(/*MustBeDeclaration=*/true,
/*AddLevel=*/!Style.BraceWrapping.AfterExternBlock);
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75791/new/
https://reviews.llvm.org/D75791
More information about the cfe-commits
mailing list