cpp11-migrate: New mechanism for overriding file contents

Next step toward supporting migrating headers. Instead of using ClangTool's
ability to override all files at once, use a custom FrontendAction and override
only the source (and eventually headers) the action is about to parse.

Use of newFrontendActionFactory() is replaced with a new factory maker provided
by Transform.

llvm-svn: 183855
This commit is contained in:
Edwin Vane
2013-06-12 19:52:13 +00:00
parent 31c60f740e
commit a6bbcdd707
6 changed files with 90 additions and 31 deletions

View File

@@ -37,12 +37,6 @@ int AddOverrideTransform::apply(const FileContentsByPath &InputStates,
FileContentsByPath &ResultStates) {
RefactoringTool AddOverrideTool(Database, SourcePaths);
for (FileContentsByPath::const_iterator I = InputStates.begin(),
E = InputStates.end();
I != E; ++I) {
AddOverrideTool.mapVirtualFile(I->first, I->second);
}
unsigned AcceptedChanges = 0;
MatchFinder Finder;
@@ -53,8 +47,8 @@ int AddOverrideTransform::apply(const FileContentsByPath &InputStates,
Finder.addMatcher(makeCandidateForOverrideAttrMatcher(), &Fixer);
if (int result = AddOverrideTool.run(
newFrontendActionFactory(&Finder, /*Callbacks=*/ this))) {
if (int result =
AddOverrideTool.run(createActionFactory(Finder, InputStates))) {
llvm::errs() << "Error encountered during translation.\n";
return result;
}