migrator: set up placeholder migration scripts for swift 4.2

This commit is contained in:
Xi Ge
2018-12-18 11:40:15 -08:00
parent c4bf8fd92e
commit 4164600bed
9 changed files with 37 additions and 8 deletions

View File

@@ -1079,8 +1079,11 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
return false;
}
static std::string getScriptFileName(StringRef name) {
return (Twine(name) + "4" + ".json").str();
static std::string getScriptFileName(StringRef name, version::Version &ver) {
if (ver.isVersionAtLeast(4, 2))
return (Twine(name) + "42" + ".json").str();
else
return (Twine(name) + "4" + ".json").str();
}
static bool ParseMigratorArgs(MigratorOptions &Opts,
@@ -1124,20 +1127,20 @@ static bool ParseMigratorArgs(MigratorOptions &Opts,
bool Supported = true;
llvm::SmallString<128> dataPath(basePath);
auto &langVer = LangOpts.EffectiveLanguageVersion;
if (Triple.isMacOSX())
llvm::sys::path::append(dataPath, getScriptFileName("macos"));
llvm::sys::path::append(dataPath, getScriptFileName("macos", langVer));
else if (Triple.isiOS())
llvm::sys::path::append(dataPath, getScriptFileName("ios"));
llvm::sys::path::append(dataPath, getScriptFileName("ios", langVer));
else if (Triple.isTvOS())
llvm::sys::path::append(dataPath, getScriptFileName("tvos"));
llvm::sys::path::append(dataPath, getScriptFileName("tvos", langVer));
else if (Triple.isWatchOS())
llvm::sys::path::append(dataPath, getScriptFileName("watchos"));
llvm::sys::path::append(dataPath, getScriptFileName("watchos", langVer));
else
Supported = false;
if (Supported) {
llvm::SmallString<128> authoredDataPath(basePath);
llvm::sys::path::append(authoredDataPath, getScriptFileName("overlay"));
llvm::sys::path::append(authoredDataPath, getScriptFileName("overlay", langVer));
// Add authored list first to take higher priority.
Opts.APIDigesterDataStorePaths.push_back(authoredDataPath.str());
Opts.APIDigesterDataStorePaths.push_back(dataPath.str());