[arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133323 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 0024818..0128d6e 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -130,6 +130,9 @@
setCurrentFile(Filename, InputKind);
setCompilerInstance(&CI);
+ if (!BeginInvocation(CI))
+ goto failure;
+
// AST files follow a very different path, since they share objects via the
// AST unit.
if (InputKind == IK_AST) {
@@ -386,8 +389,13 @@
llvm::StringRef InFile) {
return WrappedAction->CreateASTConsumer(CI, InFile);
}
+bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) {
+ return WrappedAction->BeginInvocation(CI);
+}
bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI,
llvm::StringRef Filename) {
+ WrappedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind());
+ WrappedAction->setCompilerInstance(&CI);
return WrappedAction->BeginSourceFileAction(CI, Filename);
}
void WrapperFrontendAction::ExecuteAction() {