Skip to content

Commit 6686bd9

Browse files
authored
Merge pull request swiftlang#75737 from swiftlang/revert-75594-script-load-foundation-early
Revert "[immediate] Load Foundation early enough for bridging"
2 parents 72f8f60 + 1f00ffe commit 6686bd9

File tree

5 files changed

+0
-65
lines changed

5 files changed

+0
-65
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ ERROR(error_immediate_mode_missing_library,none,
115115
(unsigned, StringRef))
116116
ERROR(error_immediate_mode_primary_file,none,
117117
"immediate mode is incompatible with -primary-file", ())
118-
WARNING(warning_immediate_mode_cannot_load_foundation,none,
119-
"immediate mode failed to load Foundation: %0", (StringRef))
120118
ERROR(error_missing_frontend_action,none,
121119
"no frontend action was selected", ())
122120
ERROR(error_invalid_source_location_str,none,

include/swift/Immediate/Immediate.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
namespace swift {
2626
class CompilerInstance;
27-
class DiagnosticEngine;
2827
class IRGenOptions;
2928
class SILOptions;
3029
class SILModule;
@@ -45,9 +44,6 @@ namespace swift {
4544

4645
int RunImmediatelyFromAST(CompilerInstance &CI);
4746

48-
/// On platforms that support ObjC bridging from the Foundation framework,
49-
/// ensure that Foundation is loaded early enough. Otherwise does nothing.
50-
void loadFoundationIfNeeded(DiagnosticEngine &Diags);
5147
} // end namespace swift
5248

5349
#endif // SWIFT_IMMEDIATE_IMMEDIATE_H

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,13 +1955,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
19551955
return finishDiagProcessing(1, /*verifierEnabled*/ false);
19561956
}
19571957

1958-
// Scripts that use the Foundation framework need it loaded early for bridging
1959-
// to work correctly on Darwin platforms. On other platforms this is a no-op.
1960-
if (Invocation.getFrontendOptions().RequestedAction ==
1961-
FrontendOptions::ActionType::Immediate) {
1962-
loadFoundationIfNeeded(Instance->getDiags());
1963-
}
1964-
19651958
// Don't ask clients to report bugs when running a script in immediate mode.
19661959
// When a script asserts the compiler reports the error with the same
19671960
// stacktrace as a compiler crash. From here we can't tell which is which,

lib/Immediate/Immediate.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -432,30 +432,3 @@ int swift::RunImmediatelyFromAST(CompilerInstance &CI) {
432432

433433
return *Result;
434434
}
435-
436-
void swift::loadFoundationIfNeeded(DiagnosticEngine &Diags) {
437-
#if defined(__APPLE__)
438-
const char *FoundationPath =
439-
"/System/Library/Frameworks/Foundation.framework/Foundation";
440-
void *handle = dlopen(FoundationPath, RTLD_NOLOAD);
441-
if (handle) {
442-
// Foundation is already loaded. Use dlclose to release the ref-count that
443-
// was incremented by dlopen and return.
444-
dlclose(handle);
445-
return;
446-
} else {
447-
// Foundation is not yet loaded. Load it now and leak the handle.
448-
// FIXME: it is fragile to load here, as there is no guarantee the swift
449-
// runtime has not initialized already. As the compiler adds more swift code
450-
// we may need to move this or find another solution.
451-
handle = dlopen(FoundationPath, RTLD_LAZY | RTLD_GLOBAL);
452-
if (!handle)
453-
Diags.diagnose(SourceLoc(),
454-
diag::warning_immediate_mode_cannot_load_foundation,
455-
dlerror());
456-
}
457-
458-
#else
459-
// Nothing to do.
460-
#endif
461-
}

test/Interpreter/foundation-bridge-error.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)