[driver] Remove the 'swift-fixit' symlink and introduce '-emit-fixits-path' frontend option that

writes compiler fixits as source edits.

Driver option '-fixit-code' adds '-emit-fixits-path' for all the frontend invocations.

Swift SVN r27208
This commit is contained in:
Argyrios Kyrtzidis
2015-04-10 17:33:29 +00:00
parent 4e6efcb617
commit 8b250d6d35
22 changed files with 176 additions and 258 deletions

View File

@@ -156,10 +156,6 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
SmallString<128> SwiftUpdatePath = llvm::sys::path::parent_path(Exec);
llvm::sys::path::append(SwiftUpdatePath, "swift-update");
Exec = Args.MakeArgString(SwiftUpdatePath.str());
} else if (OI.CompilerMode == OutputInfo::Mode::FixCode) {
SmallString<128> SwiftFixPath = llvm::sys::path::parent_path(Exec);
llvm::sys::path::append(SwiftFixPath, "swift-fixit");
Exec = Args.MakeArgString(SwiftFixPath.str());
} else {
// Invoke ourselves in -frontend mode.
Arguments.push_back("-frontend");
@@ -230,7 +226,6 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
case OutputInfo::Mode::REPL:
FrontendModeOption = "-repl";
break;
case OutputInfo::Mode::FixCode:
case OutputInfo::Mode::UpdateCode:
// Make sure that adding '-update-code' will permit accepting all arguments
// '-c' accepts.
@@ -248,7 +243,6 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
// Add input arguments.
switch (OI.CompilerMode) {
case OutputInfo::Mode::StandardCompile:
case OutputInfo::Mode::FixCode:
case OutputInfo::Mode::UpdateCode: {
if (isa<BackendJobAction>(JA)) {
assert(Inputs->size() == 1 && "The Swift backend expects one input!");
@@ -316,7 +310,6 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
switch (OI.CompilerMode) {
case OutputInfo::Mode::StandardCompile:
case OutputInfo::Mode::SingleCompile:
case OutputInfo::Mode::FixCode:
case OutputInfo::Mode::UpdateCode:
break;
case OutputInfo::Mode::Immediate:
@@ -365,6 +358,13 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
Arguments.push_back(ReferenceDependenciesPath.c_str());
}
const std::string &FixitsPath =
Output->getAdditionalOutputForType(types::TY_Remapping);
if (!FixitsPath.empty()) {
Arguments.push_back("-emit-fixits-path");
Arguments.push_back(FixitsPath.c_str());
}
if (OI.numThreads > 0) {
Arguments.push_back("-num-threads");
Arguments.push_back(Args.MakeArgString(Twine(OI.numThreads)));