[Frontend] Add --version as a frontend flag.

The new driver will defer to the frontend to print version information,
rather than embedded the version information itself.
This commit is contained in:
Doug Gregor
2020-06-24 21:34:28 -07:00
parent 603ca955ad
commit 46f9f2147c
6 changed files with 32 additions and 3 deletions

View File

@@ -1297,7 +1297,13 @@ static bool performCompile(CompilerInstance &Instance,
return precompileClangModule(Instance);
if (Action == FrontendOptions::ActionType::DumpPCM)
return dumpPrecompiledClangModule(Instance);
if (Action == FrontendOptions::ActionType::PrintVersion) {
llvm::outs() << version::getSwiftFullVersion(
version::Version::getCurrentLanguageVersion()) << '\n';
llvm::outs() << "Target: "
<< Invocation.getLangOptions().Target.str() << '\n';
return false;
}
if (Action == FrontendOptions::ActionType::CompileModuleFromInterface)
return buildModuleFromInterface(Instance);