Merge pull request #30393 from bitjammer/acgarland/rdar-59262057-ssge-maccatalyst

[SymbolGraph] Add macCatalyst compatibility
This commit is contained in:
AG
2020-03-13 09:35:39 -07:00
committed by GitHub
3 changed files with 30 additions and 15 deletions

View File

@@ -59,30 +59,24 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
DiagnosticOpts.DiagnosticDocumentationPath = DiagnosticDocsPath.str();
}
/// If we haven't explicitly passed -prebuilt-module-cache-path, set it to
/// the default value of <resource-dir>/<platform>/prebuilt-modules.
/// @note This should be called once, after search path options and frontend
/// options have been parsed.
static void setDefaultPrebuiltCacheIfNecessary(
FrontendOptions &frontendOpts, const SearchPathOptions &searchPathOpts,
const llvm::Triple &triple) {
void CompilerInvocation::setDefaultPrebuiltCacheIfNecessary() {
if (!frontendOpts.PrebuiltModuleCachePath.empty())
if (!FrontendOpts.PrebuiltModuleCachePath.empty())
return;
if (searchPathOpts.RuntimeResourcePath.empty())
if (SearchPathOpts.RuntimeResourcePath.empty())
return;
SmallString<64> defaultPrebuiltPath{searchPathOpts.RuntimeResourcePath};
SmallString<64> defaultPrebuiltPath{SearchPathOpts.RuntimeResourcePath};
StringRef platform;
if (tripleIsMacCatalystEnvironment(triple)) {
if (tripleIsMacCatalystEnvironment(LangOpts.Target)) {
// The prebuilt cache for macCatalyst is the same as the one for macOS, not iOS
// or a separate location of its own.
platform = "macosx";
} else {
platform = getPlatformNameForTriple(triple);
platform = getPlatformNameForTriple(LangOpts.Target);
}
llvm::sys::path::append(defaultPrebuiltPath, platform, "prebuilt-modules");
frontendOpts.PrebuiltModuleCachePath = defaultPrebuiltPath.str();
FrontendOpts.PrebuiltModuleCachePath = defaultPrebuiltPath.str();
}
static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
@@ -1599,8 +1593,7 @@ bool CompilerInvocation::parseArgs(
}
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target);
setDefaultPrebuiltCacheIfNecessary(FrontendOpts, SearchPathOpts,
LangOpts.Target);
setDefaultPrebuiltCacheIfNecessary();
// Now that we've parsed everything, setup some inter-option-dependent state.
setIRGenOutputOptsFromFrontendOptions(IRGenOpts, FrontendOpts);