Skip to content

Commit b1dc1b7

Browse files
authored
Revert "[6.0][immediate] Load Foundation early enough for bridging"
1 parent aa0786c commit b1dc1b7

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
@@ -120,8 +120,6 @@ ERROR(error_immediate_mode_missing_library,none,
120120
(unsigned, StringRef))
121121
ERROR(error_immediate_mode_primary_file,none,
122122
"immediate mode is incompatible with -primary-file", ())
123-
WARNING(warning_immediate_mode_cannot_load_foundation,none,
124-
"immediate mode failed to load Foundation: %0", (StringRef))
125123
ERROR(error_missing_frontend_action,none,
126124
"no frontend action was selected", ())
127125
ERROR(error_unsupported_frontend_action, 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
@@ -1942,13 +1942,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
19421942
return finishDiagProcessing(1, /*verifierEnabled*/ false);
19431943
}
19441944

1945-
// Scripts that use the Foundation framework need it loaded early for bridging
1946-
// to work correctly on Darwin platforms. On other platforms this is a no-op.
1947-
if (Invocation.getFrontendOptions().RequestedAction ==
1948-
FrontendOptions::ActionType::Immediate) {
1949-
loadFoundationIfNeeded(Instance->getDiags());
1950-
}
1951-
19521945
// Don't ask clients to report bugs when running a script in immediate mode.
19531946
// When a script asserts the compiler reports the error with the same
19541947
// 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
@@ -431,30 +431,3 @@ int swift::RunImmediatelyFromAST(CompilerInstance &CI) {
431431

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

test/Interpreter/foundation-bridge-error.swift

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

0 commit comments

Comments
 (0)