This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Clean up code after applying replacements.
ClosedPublic

Authored by alexfh on Sep 14 2016, 10:08 AM.

Details

Summary

Remove empty namespaces and initializer list commas / colons in
affected ranges. A strawman patch: proper options for enabling the cleanup and
specifying the format style are needed.

Diff Detail

Repository
rL LLVM

Event Timeline

alexfh updated this revision to Diff 71380.Sep 14 2016, 10:08 AM
alexfh retitled this revision from to [clang-tidy] Clean up code after applying replacements..
alexfh updated this object.
alexfh added reviewers: ioeric, hokein.
alexfh added a subscriber: cfe-commits.
ioeric requested changes to this revision.Sep 15 2016, 1:33 AM
ioeric edited edge metadata.
ioeric added inline comments.
clang-tidy/ClangTidy.cpp
25 ↗(On Diff #71380)

Also add dependency on clangFormat?

159 ↗(On Diff #71380)

Do you need to update CanBeApplied and AppliedFixes in this branch as well?

202 ↗(On Diff #71380)

This FIXME is not very clear, i.e. does it mean don't apply anything for all files? Or just a single file?

206 ↗(On Diff #71380)

Add a FIXME here.

And I think this might be a better workaround for now:

format::FormatStyle InsertStyle = format::getStyle("file", File, "LLVM");
This revision now requires changes to proceed.Sep 15 2016, 1:33 AM
hokein added inline comments.Sep 15 2016, 5:23 AM
clang-tidy/ClangTidy.cpp
206 ↗(On Diff #71380)

A further thought: we might not want to hard-code the code-style here. Add a FIXME to make the style customizable?

218 ↗(On Diff #71380)

Shouldn't we check whether the overwrite operation is successful or not?

alexfh updated this revision to Diff 74160.Oct 10 2016, 12:19 PM
alexfh edited edge metadata.
alexfh marked 6 inline comments as done.
  • Addressed review comments
ioeric accepted this revision.Oct 11 2016, 1:23 AM
ioeric edited edge metadata.

lgtm

This revision is now accepted and ready to land.Oct 11 2016, 1:23 AM
This revision was automatically updated to reflect the committed changes.

Does clang-apply-replacements need a similar change?