This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Handle leading comments in using declaration
ClosedPublic

Authored by sugak on Oct 31 2017, 2:40 PM.

Details

Summary

This fixes clang-format internal assertion for the following code:

/* override */ using std::string;

Added add a unit test.

Diff Detail

Event Timeline

sugak created this revision.Oct 31 2017, 2:40 PM
sugak added inline comments.Oct 31 2017, 3:02 PM
lib/Format/UsingDeclarationsSorter.cpp
50

and this is the assertions that fails for the code referenced in the summary.

djasper accepted this revision.Nov 1 2017, 12:12 PM

Some minor remarks, but generally looks good. Thanks for fixing this!

lib/Format/UsingDeclarationsSorter.cpp
136
const auto *FirstTok

or

const FormatToken *FirstTok
142

We don't use braces around single-statement ifs in LLVM style.

145
const auto *UsingTok

or

const FormatToken *UsingTok
This revision is now accepted and ready to land.Nov 1 2017, 12:12 PM
sugak updated this revision to Diff 121165.Nov 1 2017, 12:34 PM
sugak marked 3 inline comments as done.

Updated per comments.

@djasper : Thank you for the review! Would you commit this for me?

djasper accepted this revision.Nov 7 2017, 2:19 AM

Looks good. Do you have submit access?

sugak added a comment.Nov 7 2017, 10:25 AM

@djasper: no, I do not.

djasper closed this revision.Nov 10 2017, 9:11 AM

Submitted as r317901.