Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2023-09-18 12:14:41 -07:00
62 changed files with 1264 additions and 255 deletions

View File

@@ -185,12 +185,15 @@ void CompilerInvocation::setDefaultBlocklistsIfNecessary() {
}
static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
llvm::Triple &Triple) {
LangOptions &LangOpts) {
llvm::Triple &Triple = LangOpts.Target;
llvm::SmallString<128> LibPath(SearchPathOpts.RuntimeResourcePath);
StringRef LibSubDir = getPlatformNameForTriple(Triple);
if (tripleIsMacCatalystEnvironment(Triple))
LibSubDir = "maccatalyst";
if (LangOpts.hasFeature(Feature::Embedded))
LibSubDir = "embedded";
llvm::sys::path::append(LibPath, LibSubDir);
SearchPathOpts.RuntimeLibraryPaths.clear();
@@ -298,7 +301,7 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
void CompilerInvocation::setRuntimeResourcePath(StringRef Path) {
SearchPathOpts.RuntimeResourcePath = Path.str();
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
}
void CompilerInvocation::setTargetTriple(StringRef Triple) {
@@ -307,12 +310,12 @@ void CompilerInvocation::setTargetTriple(StringRef Triple) {
void CompilerInvocation::setTargetTriple(const llvm::Triple &Triple) {
LangOpts.setTarget(Triple);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
}
void CompilerInvocation::setSDKPath(const std::string &Path) {
SearchPathOpts.setSDKPath(Path);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
}
bool CompilerInvocation::setModuleAliasMap(std::vector<std::string> args,
@@ -1322,11 +1325,17 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Opts.hasFeature(Feature::Embedded)) {
Opts.UnavailableDeclOptimizationMode = UnavailableDeclOptimization::Complete;
Opts.DisableImplicitStringProcessingModuleImport = true;
if (FrontendOpts.EnableLibraryEvolution) {
Diags.diagnose(SourceLoc(), diag::evolution_with_embedded);
HadError = true;
}
if (FrontendOpts.InputsAndOutputs.hasPrimaryInputs()) {
Diags.diagnose(SourceLoc(), diag::wmo_with_embedded);
HadError = true;
}
}
if (auto A = Args.getLastArg(OPT_checked_async_objc_bridging)) {
@@ -1344,15 +1353,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
// Is this the correct way to query for WMO?
bool isWMO =
Args.hasArg(OPT_wmo) ||
Args.hasArg(OPT_whole_module_optimization);
if (!isWMO && Opts.hasFeature(Feature::Embedded)) {
Diags.diagnose(SourceLoc(), diag::wmo_with_embedded);
HadError = true;
}
return HadError || UnsupportedOS || UnsupportedArch;
}
@@ -3101,7 +3101,7 @@ bool CompilerInvocation::parseArgs(
return true;
}
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts.Target);
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
setDefaultPrebuiltCacheIfNecessary();
setDefaultBlocklistsIfNecessary();
@@ -3110,6 +3110,7 @@ bool CompilerInvocation::parseArgs(
setBridgingHeaderFromFrontendOptions(ClangImporterOpts, FrontendOpts);
if (LangOpts.hasFeature(Feature::Embedded)) {
IRGenOpts.InternalizeAtLink = true;
IRGenOpts.DisableLegacyTypeInfo = true;
}
return false;