This is an archive of the discontinued LLVM Phabricator instance.

clang-format: Fix return type breaking with operator overload functions
ClosedPublic

Authored by poiru on Jul 14 2015, 12:03 AM.

Diff Detail

Event Timeline

poiru updated this revision to Diff 29647.Jul 14 2015, 12:03 AM
poiru retitled this revision from to clang-format: Fix return type breaking with operator overload functions.
poiru added a reviewer: djasper.
poiru added a subscriber: cfe-commits.
djasper added inline comments.Jul 14 2015, 12:39 AM
lib/Format/TokenAnnotator.cpp
509

Why is this last check important? To not mark operator()()()? Is that important?

1478

What kinds of tokens do you expect to consume here? Would it be better to be more strict, i.e. consume exactly an operator, "new", "delete", "()" and such?

1512

This is very similar to the above. What are the exact differences (maybe add a comment)? Could we factor some of this out into a local function or a lambda?

1515

According to LLVM coding standards, no "else" after "return", "break" or "continue".

2206

I think this is incorrect as we currently break after the coloncolon if a nested name specifier has to be split, e.g.:

void AssumeThisIsAVeryLongTypeOrSetASmallColumnLimit::
    operator+() {
}
poiru added inline comments.Jul 15 2015, 11:35 AM
lib/Format/TokenAnnotator.cpp
509

Probably not, removed.

1478

Done.

1512

Done.

2206

Removed this bit, thanks.

poiru updated this revision to Diff 29805.Jul 15 2015, 11:35 AM

Addressed review comments.

djasper accepted this revision.Jul 15 2015, 11:51 AM
djasper edited edge metadata.

Looks good. Thank you!

This revision is now accepted and ready to land.Jul 15 2015, 11:51 AM
This revision was automatically updated to reflect the committed changes.