This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Force braces around leaf 'else if' for consistency.
ClosedPublic

Authored by sbenza on Jun 4 2015, 8:06 AM.

Diff Detail

Event Timeline

sbenza updated this revision to Diff 27120.Jun 4 2015, 8:06 AM
sbenza retitled this revision from to [clang-tidy] Force braces around leaf 'else if' for consistency..
sbenza updated this object.
sbenza edited the test plan for this revision. (Show Details)
sbenza added a reviewer: alexfh.
sbenza added a subscriber: Unknown Object (MLST).
alexfh accepted this revision.Jun 4 2015, 9:21 AM
alexfh edited edge metadata.

Thanks for the fix! LG

BTW, it seems wrong that we don't allow if-else chains without braces, when every body fits on one line.

if (...) ...;
else if (....) ...;
...

or

if (...)
  ...;
else if (....)
  ...;
...

depending on the style and ShortStatementLines setting.

This revision is now accepted and ready to land.Jun 4 2015, 9:21 AM
sbenza added a comment.Jun 4 2015, 9:38 AM

I think it does that because we are looking at the range between the start of the "then" until the "else" keyword, and that has a newline in it.
But that is a different bug to fix.

This revision was automatically updated to reflect the committed changes.