mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Backtracing] Remove support for implicit import of _Backtracing.
We're going to rename the module to Runtime, and it isn't going to be an implicit import, so we don't need any of this. rdar://124913332
This commit is contained in:
@@ -695,10 +695,6 @@ option(SWIFT_IMPLICIT_CONCURRENCY_IMPORT
|
||||
"Implicitly import the Swift concurrency module"
|
||||
TRUE)
|
||||
|
||||
option(SWIFT_IMPLICIT_BACKTRACING_IMPORT
|
||||
"Implicitly import the Swift backtracing module"
|
||||
FALSE)
|
||||
|
||||
option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
|
||||
"Enable build of the Swift concurrency module"
|
||||
FALSE)
|
||||
@@ -865,11 +861,6 @@ if (CMAKE_Swift_COMPILER)
|
||||
SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
|
||||
message(STATUS " Implicit 'string-processing' import: ${SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT}")
|
||||
|
||||
# Same for _Backtracing.
|
||||
swift_supports_implicit_module("backtracing"
|
||||
SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
|
||||
message(STATUS " Implicit 'backtracing' import: ${SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT}")
|
||||
|
||||
swift_get_package_cmo_support(
|
||||
Swift_COMPILER_PACKAGE_CMO_SUPPORT)
|
||||
message(STATUS " Package CMO: ${Swift_COMPILER_PACKAGE_CMO_SUPPORT}")
|
||||
|
||||
@@ -28,13 +28,7 @@ function(_add_host_swift_compile_options name)
|
||||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
|
||||
endif()
|
||||
|
||||
# Same for backtracing
|
||||
if (SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
|
||||
target_compile_options(${name} PRIVATE
|
||||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-backtracing-module-import>")
|
||||
endif()
|
||||
|
||||
if(SWIFT_ANALYZE_CODE_COVERAGE)
|
||||
if(SWIFT_ANALYZE_CODE_COVERAGE)
|
||||
set(_cov_flags $<$<COMPILE_LANGUAGE:Swift>:-profile-generate -profile-coverage-mapping>)
|
||||
target_compile_options(${name} PRIVATE ${_cov_flags})
|
||||
target_link_options(${name} PRIVATE ${_cov_flags})
|
||||
|
||||
@@ -188,8 +188,6 @@ WARNING(warn_implicit_concurrency_import_failed,none,
|
||||
"unable to perform implicit import of \"_Concurrency\" module: no such module found", ())
|
||||
REMARK(warn_implicit_string_processing_import_failed,none,
|
||||
"unable to perform implicit import of \"_StringProcessing\" module: no such module found", ())
|
||||
REMARK(warn_implicit_backtracing_import_failed,none,
|
||||
"unable to perform implicit import of \"_Backtracing\" module: no such module found", ())
|
||||
|
||||
ERROR(error_bad_module_name,none,
|
||||
"module name \"%0\" is not a valid identifier"
|
||||
|
||||
@@ -421,10 +421,6 @@ namespace swift {
|
||||
/// Disable the implicit import of the _StringProcessing module.
|
||||
bool DisableImplicitStringProcessingModuleImport = false;
|
||||
|
||||
/// Disable the implicit import of the _Backtracing module.
|
||||
bool DisableImplicitBacktracingModuleImport =
|
||||
!SWIFT_IMPLICIT_BACKTRACING_IMPORT;
|
||||
|
||||
/// Disable the implicit import of the Cxx module.
|
||||
bool DisableImplicitCxxModuleImport = false;
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#cmakedefine01 SWIFT_IMPLICIT_CONCURRENCY_IMPORT
|
||||
|
||||
#cmakedefine01 SWIFT_IMPLICIT_BACKTRACING_IMPORT
|
||||
|
||||
#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED
|
||||
|
||||
#cmakedefine01 SWIFT_ENABLE_GLOBAL_ISEL_ARM64
|
||||
|
||||
@@ -425,10 +425,6 @@ public:
|
||||
/// imported.
|
||||
bool shouldImportSwiftStringProcessing() const;
|
||||
|
||||
/// Whether the Swift Backtracing support library should be implicitly
|
||||
/// imported.
|
||||
bool shouldImportSwiftBacktracing() const;
|
||||
|
||||
/// Whether the CXX module should be implicitly imported.
|
||||
bool shouldImportCxx() const;
|
||||
|
||||
@@ -679,14 +675,6 @@ public:
|
||||
/// i.e. if it can be found.
|
||||
bool canImportSwiftStringProcessing() const;
|
||||
|
||||
/// Verify that if an implicit import of the `Backtracing` module if
|
||||
/// expected, it can actually be imported. Emit a warning, otherwise.
|
||||
void verifyImplicitBacktracingImport();
|
||||
|
||||
/// Whether the Swift Backtracing support library can be imported
|
||||
/// i.e. if it can be found.
|
||||
bool canImportSwiftBacktracing() const;
|
||||
|
||||
/// Whether the Cxx library can be imported
|
||||
bool canImportCxx() const;
|
||||
|
||||
|
||||
@@ -517,14 +517,6 @@ def disable_implicit_string_processing_module_import : Flag<["-"],
|
||||
"disable-implicit-string-processing-module-import">,
|
||||
HelpText<"Disable the implicit import of the _StringProcessing module.">;
|
||||
|
||||
def enable_implicit_backtracing_module_import : Flag<["-"],
|
||||
"enable-implicit-backtracing-module-import">,
|
||||
HelpText<"Enable the implicit import of the _Backtracing module.">;
|
||||
|
||||
def disable_implicit_backtracing_module_import : Flag<["-"],
|
||||
"disable-implicit-backtracing-module-import">,
|
||||
HelpText<"Disable the implicit import of the _Backtracing module.">;
|
||||
|
||||
def disable_implicit_cxx_module_import : Flag<["-"],
|
||||
"disable-implicit-cxx-module-import">,
|
||||
HelpText<"Disable the implicit import of the C++ Standard Library module.">;
|
||||
|
||||
@@ -33,8 +33,6 @@ constexpr static const StringLiteral SWIFT_MODULE_ABI_NAME_PREFIX = "Compiler";
|
||||
constexpr static const StringLiteral SWIFT_DISTRIBUTED_NAME = "Distributed";
|
||||
/// The name of the StringProcessing module, which supports that extension.
|
||||
constexpr static const StringLiteral SWIFT_STRING_PROCESSING_NAME = "_StringProcessing";
|
||||
/// The name of the Backtracing module, which supports that extension.
|
||||
constexpr static const StringLiteral SWIFT_BACKTRACING_NAME = "_Backtracing";
|
||||
/// The name of the SwiftShims module, which contains private stdlib decls.
|
||||
constexpr static const StringLiteral SWIFT_SHIMS_NAME = "SwiftShims";
|
||||
/// The name of the CxxShim module, which contains a cxx casting utility.
|
||||
|
||||
@@ -939,11 +939,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
Opts.DisableImplicitCxxModuleImport |=
|
||||
Args.hasArg(OPT_disable_implicit_cxx_module_import);
|
||||
|
||||
Opts.DisableImplicitBacktracingModuleImport =
|
||||
Args.hasFlag(OPT_disable_implicit_backtracing_module_import,
|
||||
OPT_enable_implicit_backtracing_module_import,
|
||||
true);
|
||||
|
||||
if (Args.hasArg(OPT_enable_experimental_async_top_level))
|
||||
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
|
||||
"-enable-experimental-async-top-level");
|
||||
|
||||
@@ -1109,20 +1109,6 @@ bool CompilerInvocation::shouldImportSwiftStringProcessing() const {
|
||||
FrontendOptions::ParseInputMode::SwiftModuleInterface;
|
||||
}
|
||||
|
||||
/// Enable Swift backtracing on a per-target basis
|
||||
static bool shouldImportSwiftBacktracingByDefault(const llvm::Triple &target) {
|
||||
if (target.isOSDarwin() || target.isOSWindows() || target.isOSLinux())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CompilerInvocation::shouldImportSwiftBacktracing() const {
|
||||
return shouldImportSwiftBacktracingByDefault(getLangOptions().Target) &&
|
||||
!getLangOptions().DisableImplicitBacktracingModuleImport &&
|
||||
getFrontendOptions().InputMode !=
|
||||
FrontendOptions::ParseInputMode::SwiftModuleInterface;
|
||||
}
|
||||
|
||||
bool CompilerInvocation::shouldImportCxx() const {
|
||||
// C++ Interop is disabled
|
||||
if (!getLangOptions().EnableCXXInterop)
|
||||
@@ -1209,21 +1195,6 @@ bool CompilerInstance::canImportSwiftStringProcessing() const {
|
||||
return getASTContext().testImportModule(modulePath);
|
||||
}
|
||||
|
||||
void CompilerInstance::verifyImplicitBacktracingImport() {
|
||||
if (Invocation.shouldImportSwiftBacktracing() &&
|
||||
!canImportSwiftBacktracing()) {
|
||||
Diagnostics.diagnose(SourceLoc(),
|
||||
diag::warn_implicit_backtracing_import_failed);
|
||||
}
|
||||
}
|
||||
|
||||
bool CompilerInstance::canImportSwiftBacktracing() const {
|
||||
ImportPath::Module::Builder builder(
|
||||
getASTContext().getIdentifier(SWIFT_BACKTRACING_NAME));
|
||||
auto modulePath = builder.get();
|
||||
return getASTContext().testImportModule(modulePath);
|
||||
}
|
||||
|
||||
bool CompilerInstance::canImportCxx() const {
|
||||
ImportPath::Module::Builder builder(
|
||||
getASTContext().getIdentifier(CXX_MODULE_NAME));
|
||||
@@ -1321,19 +1292,6 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
|
||||
}
|
||||
}
|
||||
|
||||
if (Invocation.shouldImportSwiftBacktracing()) {
|
||||
switch (imports.StdlibKind) {
|
||||
case ImplicitStdlibKind::Builtin:
|
||||
case ImplicitStdlibKind::None:
|
||||
break;
|
||||
|
||||
case ImplicitStdlibKind::Stdlib:
|
||||
if (canImportSwiftBacktracing())
|
||||
pushImport(SWIFT_BACKTRACING_NAME);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Invocation.getLangOptions().EnableCXXInterop) {
|
||||
if (Invocation.shouldImportCxx() && canImportCxx())
|
||||
pushImport(CXX_MODULE_NAME);
|
||||
|
||||
@@ -228,12 +228,6 @@ swift_create_stdlib_targets("swift-test-stdlib" "" FALSE)
|
||||
swift_create_stdlib_targets("swift-libexec" "" TRUE)
|
||||
swift_create_stdlib_targets("swift-test-libexec" "" FALSE)
|
||||
|
||||
# Check whether the Swift compiler we're using supports
|
||||
# -disable-implicit-backtracing-module-import
|
||||
include(SwiftCompilerCapability)
|
||||
|
||||
swift_supports_implicit_module("backtracing" SWIFT_COMPILER_SUPPORTS_BACKTRACING)
|
||||
|
||||
# FIXME: Include the toolchain directory before the public directory. Otherwise
|
||||
# the clang resource directory symlink stops installing correctly.
|
||||
add_subdirectory(toolchain)
|
||||
|
||||
@@ -2091,11 +2091,6 @@ function(add_swift_target_library name)
|
||||
# Turn off implicit import of _StringProcessing when building libraries
|
||||
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-disable-implicit-string-processing-module-import")
|
||||
|
||||
# Turn off implicit import of _Backtracing when building libraries
|
||||
if(SWIFT_COMPILER_SUPPORTS_BACKTRACING)
|
||||
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-disable-implicit-backtracing-module-import")
|
||||
endif()
|
||||
|
||||
if(SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_ENABLE_PRESPECIALIZATION)
|
||||
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-prespecialize-generic-metadata")
|
||||
endif()
|
||||
@@ -3126,10 +3121,6 @@ function(add_swift_target_executable name)
|
||||
"-Xfrontend;-disable-implicit-string-processing-module-import")
|
||||
endif()
|
||||
|
||||
if(SWIFT_IMPLICIT_BACKTRACING_IMPORT)
|
||||
list(APPEND SWIFTEXE_TARGET_COMPILE_FLAGS "-Xfrontend;-disable-implicit-backtracing-module-import")
|
||||
endif()
|
||||
|
||||
if(SWIFT_BUILD_STDLIB)
|
||||
# All Swift executables depend on the standard library.
|
||||
list(APPEND SWIFTEXE_TARGET_SWIFT_MODULE_DEPENDS Core)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-build-swift %s -Xfrontend -enable-implicit-backtracing-module-import -parse-as-library -Onone -o %t/SimpleBacktrace
|
||||
// RUN: %target-build-swift %s -Xfrontend -parse-as-library -Onone -o %t/SimpleBacktrace
|
||||
// RUN: %target-codesign %t/SimpleBacktrace
|
||||
// RUN: %target-run %t/SimpleBacktrace | %FileCheck %s
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// UNSUPPORTED: use_os_stdlib
|
||||
// UNSUPPORTED: back_deployment_runtime
|
||||
|
||||
import _Backtracing
|
||||
|
||||
func level1() {
|
||||
level2()
|
||||
}
|
||||
|
||||
@@ -116,14 +116,6 @@ def disable_implicit_string_processing_module_import : Flag<["-"],
|
||||
"disable-implicit-string-processing-module-import">,
|
||||
HelpText<"Disable implicit import of the _StringProcessing module">;
|
||||
|
||||
def enable_implicit_backtracing_module_import : Flag<["-"],
|
||||
"enable-implicit-backtracing-module-import">,
|
||||
HelpText<"Enable implicit import of the _Backtracing module">;
|
||||
|
||||
def disable_implicit_backtracing_module_import : Flag<["-"],
|
||||
"disable-implicit-backtracing-module-import">,
|
||||
HelpText<"Disable implicit import of the _Backtracing module">;
|
||||
|
||||
def end_pos : Separate<["-"], "end-pos">, HelpText<"line:col">;
|
||||
def end_pos_EQ : Joined<["-"], "end-pos=">, Alias<end_pos>;
|
||||
|
||||
|
||||
@@ -464,10 +464,6 @@ bool TestOptions::parseArgs(llvm::ArrayRef<const char *> Args) {
|
||||
DisableImplicitStringProcessingModuleImport = true;
|
||||
break;
|
||||
|
||||
case OPT_disable_implicit_backtracing_module_import:
|
||||
DisableImplicitBacktracingModuleImport = true;
|
||||
break;
|
||||
|
||||
case OPT_UNKNOWN:
|
||||
llvm::errs() << "error: unknown argument: "
|
||||
<< InputArg->getAsString(ParsedArgs) << '\n'
|
||||
|
||||
@@ -135,8 +135,6 @@ struct TestOptions {
|
||||
bool measureInstructions = false;
|
||||
bool DisableImplicitConcurrencyModuleImport = false;
|
||||
bool DisableImplicitStringProcessingModuleImport = false;
|
||||
bool EnableImplicitBacktracingModuleImport = false;
|
||||
bool DisableImplicitBacktracingModuleImport = false;
|
||||
std::optional<unsigned> CompletionCheckDependencyInterval;
|
||||
unsigned repeatRequest = 1;
|
||||
struct VFSFile {
|
||||
|
||||
@@ -1222,20 +1222,6 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
|
||||
"-disable-implicit-string-processing-module-import");
|
||||
}
|
||||
if (Opts.EnableImplicitBacktracingModuleImport &&
|
||||
!compilerArgsAreClang) {
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
|
||||
"-Xfrontend");
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
|
||||
"-enable-implicit-backtracing-module-import");
|
||||
}
|
||||
if (Opts.DisableImplicitBacktracingModuleImport &&
|
||||
!compilerArgsAreClang) {
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
|
||||
"-Xfrontend");
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
|
||||
"-disable-implicit-backtracing-module-import");
|
||||
}
|
||||
|
||||
for (auto Arg : Opts.CompilerArgs)
|
||||
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND, Arg);
|
||||
|
||||
@@ -833,16 +833,6 @@ DisableImplicitStringProcessingImport("disable-implicit-string-processing-module
|
||||
llvm::cl::desc("Disable implicit import of _StringProcessing module"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
EnableImplicitBacktracingImport("enable-implicit-backtracing-module-import",
|
||||
llvm::cl::desc("Enable implicit import of _Backtracing module"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
DisableImplicitBacktracingImport("disable-implicit-backtracing-module-import",
|
||||
llvm::cl::desc("Disable implicit import of _Backtracing module"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
static llvm::cl::opt<bool> EnableExperimentalNamedOpaqueTypes(
|
||||
"enable-experimental-named-opaque-types",
|
||||
llvm::cl::desc("Enable experimental support for named opaque result types"),
|
||||
@@ -4470,13 +4460,6 @@ int main(int argc, char *argv[]) {
|
||||
if (options::DisableImplicitStringProcessingImport) {
|
||||
InitInvok.getLangOptions().DisableImplicitStringProcessingModuleImport = true;
|
||||
}
|
||||
if (options::DisableImplicitBacktracingImport) {
|
||||
InitInvok.getLangOptions().DisableImplicitBacktracingModuleImport = true;
|
||||
} else if (options::EnableImplicitBacktracingImport) {
|
||||
InitInvok.getLangOptions().DisableImplicitBacktracingModuleImport = false;
|
||||
} else {
|
||||
InitInvok.getLangOptions().DisableImplicitBacktracingModuleImport = true;
|
||||
}
|
||||
|
||||
if (options::EnableExperimentalNamedOpaqueTypes) {
|
||||
InitInvok.getLangOptions().enableFeature(Feature::NamedOpaqueTypes);
|
||||
|
||||
Reference in New Issue
Block a user