mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
migrator: set up placeholder migration scripts for swift 4.2
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user