This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Make parseUnaryOperator non-recursive, NFCI
ClosedPublic

Authored by krasimir on Nov 1 2017, 10:41 AM.

Details

Summary

This patch makes the implementation of parseUnaryOperator non-recursive. We had
a problem with a file starting with tens of thousands of +'es and -'es which
caused clang-format to stack overflow.

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Nov 1 2017, 10:41 AM
krasimir added a subscriber: cfe-commits.
bkramer accepted this revision.Nov 1 2017, 10:53 AM

lg

lib/Format/TokenAnnotator.cpp
1671 ↗(On Diff #121147)

for (FormatToken *Token : llvm::reverse(Tokens))

This revision is now accepted and ready to land.Nov 1 2017, 10:53 AM
krasimir updated this revision to Diff 121156.Nov 1 2017, 11:17 AM
  • Address review comments
krasimir added inline comments.Nov 1 2017, 11:18 AM
lib/Format/TokenAnnotator.cpp
1671 ↗(On Diff #121147)

Wow! That's so cool! Thanks!

This revision was automatically updated to reflect the committed changes.