This is an archive of the discontinued LLVM Phabricator instance.

clang-format: refine calculating brace types.
ClosedPublic

Authored by mprobst on May 9 2017, 9:42 AM.

Details

Summary

For C++ code, opening parenthesis following a } indicate a braced init. For JavaScript and other languages, this is an invalid syntactical construct, unless the closing parenthesis belongs to a function - in which situation its a BK_Block.

This fixes indenting IIFEs following top level functions:

function foo() {}
(function() { codeHere(); }());

clang-format used to collapse these lines together.

Diff Detail

Repository
rL LLVM

Event Timeline

mprobst created this revision.May 9 2017, 9:42 AM
mprobst updated this revision to Diff 98309.May 9 2017, 9:44 AM
  • handle ObjC
mprobst added a subscriber: cfe-commits.
djasper accepted this revision.May 10 2017, 6:32 AM

Looks good.

This revision is now accepted and ready to land.May 10 2017, 6:32 AM
This revision was automatically updated to reflect the committed changes.