This is an archive of the discontinued LLVM Phabricator instance.

[include-fixer] Support processing multiple files in one run.
ClosedPublic

Authored by hokein on Aug 8 2016, 8:00 AM.

Details

Summary

Previously, if we pass multiple files or a file pattern (e.g. /path/to/*.cc) to
include-fixer, include-fixer will apply all replacements to the first argument,
which probably causes crashes.

With this patch, include-fixer can process multiple files now.

Vim and Emacs integration are tested manually.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein updated this revision to Diff 67170.Aug 8 2016, 8:00 AM
hokein retitled this revision from to [include-fixer] Support processing multiple files in one run..
hokein updated this object.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.
hokein updated this revision to Diff 67171.Aug 8 2016, 8:03 AM

Remove unneeded header.

hokein updated this revision to Diff 67172.Aug 8 2016, 8:03 AM

Add missing tests.

bkramer edited edge metadata.Aug 8 2016, 8:27 AM

Can you add a lit test for this? We should've added that earlier :|

include-fixer/IncludeFixer.h
53 ↗(On Diff #67171)

This comment is now outdated, there are multiple contexts.

include-fixer/IncludeFixerContext.h
21 ↗(On Diff #67171)

A context for a file being processed.

78 ↗(On Diff #67171)

Does it have to be absolute?

hokein updated this revision to Diff 67178.Aug 8 2016, 8:44 AM
hokein marked 2 inline comments as done.
hokein edited edge metadata.

Address review comments.

hokein added a comment.Aug 8 2016, 8:44 AM

Can you add a lit test for this? We should've added that earlier :|

I forgot to upload the test first time. But I have already uploaded it, see multiple_fixes.cpp

include-fixer/IncludeFixerContext.h
78 ↗(On Diff #67172)

It depends on InFile parameter in clang::ASTFrontendAction::CreateASTConsumer method. Isn't it always an absolute file path?

bkramer accepted this revision.Aug 8 2016, 9:05 AM
bkramer edited edge metadata.

lgtm

include-fixer/IncludeFixerContext.h
78 ↗(On Diff #67178)

I don't think there are any guarantees about that.

This revision is now accepted and ready to land.Aug 8 2016, 9:05 AM
hokein updated this revision to Diff 67294.Aug 9 2016, 1:19 AM
hokein edited edge metadata.

Update comments, don't mention absolute file path since this is no guarantee
about that.

This revision was automatically updated to reflect the committed changes.