This is an archive of the discontinued LLVM Phabricator instance.

[clang-include-fixer] Added Vim integration for clang-include-fixer.
ClosedPublic

Authored by ioeric on May 17 2016, 6:50 AM.

Diff Detail

Event Timeline

ioeric updated this revision to Diff 57474.May 17 2016, 6:50 AM
ioeric retitled this revision from to [clang-include-fixer] Added Vim integration for clang-include-fixer..
ioeric updated this object.
ioeric added reviewers: bkramer, hokein.
ioeric added a subscriber: cfe-commits.
bkramer added inline comments.May 17 2016, 7:09 AM
include-fixer/tool/ClangIncludeFixer.cpp
51

This isn't really specific to vim, we should name it differently. '-stdin' maybe? Then document what it really does.

include-fixer/tool/clang-include-fixer.py
39

yaml is the default, maybe we shouldn't specify it here? Or leave the user a way to configure it.

50

This always inserts at the top. Can we emit the position where to insert from the tool and put it there?

hokein added inline comments.May 17 2016, 7:18 AM
include-fixer/tool/ClangIncludeFixer.cpp
51

I think we can make the include-fixer accept stdin input by default if there is no command-line file path. In this case, there is no need to add a command-line option here.

include-fixer/tool/clang-include-fixer.py
51

Add if __name__ == '__main__':.

ioeric updated this revision to Diff 57484.May 17 2016, 8:21 AM
ioeric marked 4 inline comments as done.
  • Changed VimMode to STDINMode, and made clang-include-fixer return insertion line number in this mode.
  • Added -db, -input options into Vim integration.
include-fixer/tool/ClangIncludeFixer.cpp
51

We can't get the compile options for the code if we only accept <stdin> input (without the corresponding file path).

bkramer edited edge metadata.May 18 2016, 2:00 AM

I expect the insertion code in the python part to cause trouble in the future again but I guess this is fine for now.

Can you add a section to include-fixer.rst on how to set this up?

ioeric updated this revision to Diff 57615.May 18 2016, 7:09 AM
ioeric edited edge metadata.
  • Added docs for Vim integration into include-fixer.rst.
bkramer accepted this revision.May 18 2016, 7:11 AM
bkramer edited edge metadata.

lg

This revision is now accepted and ready to land.May 18 2016, 7:11 AM
This revision was automatically updated to reflect the committed changes.