diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt index e6bc6274ed1fe..6d2529cc01a87 100644 --- a/stdlib/public/runtime/CMakeLists.txt +++ b/stdlib/public/runtime/CMakeLists.txt @@ -51,9 +51,7 @@ set(swift_runtime_sources Once.cpp Portability.cpp ProtocolConformance.cpp - ReflectionNative.cpp - RuntimeEntrySymbols.cpp - SwiftObjectNative.cpp) + RuntimeEntrySymbols.cpp) # Acknowledge that the following sources are known. set(LLVM_OPTIONAL_SOURCES @@ -119,16 +117,7 @@ add_swift_library(swiftRuntime OBJECT_LIBRARY TARGET_LIBRARY ${swift_runtime_leaks_sources} C_COMPILE_FLAGS ${swift_runtime_library_compile_flags} LINK_FLAGS ${swift_runtime_linker_flags} - INSTALL_IN_COMPONENT never_install - TARGET_SDKS ALL_APPLE_PLATFORMS) - -add_swift_library(swiftRuntime OBJECT_LIBRARY TARGET_LIBRARY - ${swift_runtime_sources} - ${swift_runtime_leaks_sources} - C_COMPILE_FLAGS ${swift_runtime_library_compile_flags} - LINK_FLAGS ${swift_runtime_linker_flags} - INSTALL_IN_COMPONENT never_install - TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX) + INSTALL_IN_COMPONENT never_install) set(ELFISH_SDKS) foreach(sdk ${SWIFT_CONFIGURED_SDKS}) diff --git a/stdlib/public/runtime/ErrorObject.mm b/stdlib/public/runtime/ErrorObject.mm index a30136c50e814..58cfbe0661831 100644 --- a/stdlib/public/runtime/ErrorObject.mm +++ b/stdlib/public/runtime/ErrorObject.mm @@ -21,6 +21,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #include "swift/Runtime/Debug.h" #include "swift/Runtime/ObjCBridge.h" #include "swift/Basic/Lazy.h" @@ -592,3 +595,5 @@ static void _swift_willThrow_(SwiftError *error) { } void swift::swift_willThrow(SwiftError *error) { return _swift_willThrow(error); } +#endif + diff --git a/stdlib/public/runtime/ReflectionNative.cpp b/stdlib/public/runtime/ReflectionNative.cpp deleted file mode 100644 index 7d3fae701c5b4..0000000000000 --- a/stdlib/public/runtime/ReflectionNative.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -// This file is here only to bring in the parts of Reflection.mm that apply -// when not using an objc runtime. -#include "swift/Runtime/Config.h" - -#if !SWIFT_OBJC_INTEROP -#include "Reflection.mm" -#endif diff --git a/stdlib/public/runtime/SwiftObject.mm b/stdlib/public/runtime/SwiftObject.mm index bd82e8588cd73..1df2810342fff 100644 --- a/stdlib/public/runtime/SwiftObject.mm +++ b/stdlib/public/runtime/SwiftObject.mm @@ -16,6 +16,7 @@ //===----------------------------------------------------------------------===// #include "swift/Runtime/Config.h" + #if SWIFT_OBJC_INTEROP #include #include diff --git a/stdlib/public/runtime/SwiftObjectNative.cpp b/stdlib/public/runtime/SwiftObjectNative.cpp deleted file mode 100644 index 50a1d13b35750..0000000000000 --- a/stdlib/public/runtime/SwiftObjectNative.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -// This file is here only to bring in the parts of SwiftObject.mm that apply -// when not using an objc runtime. -#include "swift/Runtime/Config.h" - -#if !SWIFT_OBJC_INTEROP -#include "SwiftObject.mm" -#endif diff --git a/stdlib/public/runtime/SwiftValue.mm b/stdlib/public/runtime/SwiftValue.mm index f000dcf540439..a35b2fa271732 100644 --- a/stdlib/public/runtime/SwiftValue.mm +++ b/stdlib/public/runtime/SwiftValue.mm @@ -18,6 +18,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #include "SwiftObject.h" #include "SwiftValue.h" #include "swift/Basic/Lazy.h" @@ -30,10 +33,6 @@ #include #include -#if !SWIFT_OBJC_INTEROP -#error "This file should only be compiled when ObjC interop is enabled." -#endif - using namespace swift; using namespace swift::hashable_support; @@ -380,6 +379,7 @@ - (const OpaqueValue *)_swiftValue { } @end +#endif // TODO: We could pick specialized _SwiftValue subclasses for trivial types // or for types with known size and alignment characteristics. Probably diff --git a/stdlib/public/stubs/Availability.mm b/stdlib/public/stubs/Availability.mm index 16281df34ec97..bacbcb4bd5568 100644 --- a/stdlib/public/stubs/Availability.mm +++ b/stdlib/public/stubs/Availability.mm @@ -14,6 +14,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #include "swift/Basic/Lazy.h" #include "swift/Runtime/Debug.h" #import @@ -93,3 +96,5 @@ static NSOperatingSystemVersion getOSVersion() { return { version.majorVersion, version.minorVersion, version.patchVersion }; } +#endif + diff --git a/stdlib/public/stubs/CMakeLists.txt b/stdlib/public/stubs/CMakeLists.txt index 630549f95c6f3..e5084d568eb83 100644 --- a/stdlib/public/stubs/CMakeLists.txt +++ b/stdlib/public/stubs/CMakeLists.txt @@ -23,16 +23,8 @@ list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS) add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY ${swift_stubs_sources} ${swift_stubs_objc_sources} - C_COMPILE_FLAGS ${swift_stubs_c_compile_flags} - LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS} - TARGET_SDKS ALL_APPLE_PLATFORMS - INSTALL_IN_COMPONENT stdlib) - -add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY - ${swift_stubs_sources} ${swift_stubs_unicode_normalization_sources} C_COMPILE_FLAGS ${swift_stubs_c_compile_flags} LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS} - TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX INSTALL_IN_COMPONENT stdlib) diff --git a/stdlib/public/stubs/FoundationHelpers.mm b/stdlib/public/stubs/FoundationHelpers.mm index a6effbd12ba18..c7e9cb10dc026 100644 --- a/stdlib/public/stubs/FoundationHelpers.mm +++ b/stdlib/public/stubs/FoundationHelpers.mm @@ -16,6 +16,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #import #include "../SwiftShims/CoreFoundationShims.h" @@ -112,3 +115,5 @@ static CFRange cast(_swift_shims_CFRange value) { swift::_swift_stdlib_objcDebugDescription(id _Nonnull nsObject) { return [nsObject debugDescription]; } +#endif + diff --git a/stdlib/public/stubs/OptionalBridgingHelper.mm b/stdlib/public/stubs/OptionalBridgingHelper.mm index 6978af41d6cf1..3df2ab3902272 100644 --- a/stdlib/public/stubs/OptionalBridgingHelper.mm +++ b/stdlib/public/stubs/OptionalBridgingHelper.mm @@ -10,6 +10,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #include "swift/Basic/Lazy.h" #include "swift/Basic/LLVM.h" #include "swift/Runtime/Metadata.h" @@ -97,3 +100,5 @@ id _swift_Foundation_getOptionalNilSentinelObject(const Metadata *Wrapped) { return objc_retain(getSentinelForDepth(depth)); } +#endif + diff --git a/stdlib/public/stubs/Reflection.mm b/stdlib/public/stubs/Reflection.mm index d41af807ff626..3eec79d3ff59c 100644 --- a/stdlib/public/stubs/Reflection.mm +++ b/stdlib/public/stubs/Reflection.mm @@ -11,6 +11,8 @@ //===----------------------------------------------------------------------===// #include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #import SWIFT_CC(swift) @@ -24,4 +26,5 @@ return result; } +#endif diff --git a/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb b/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb index a1768fbac3dea..35ed90633c304 100644 --- a/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb +++ b/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb @@ -30,6 +30,9 @@ // //===----------------------------------------------------------------------===// +#include "swift/Runtime/Config.h" + +#if SWIFT_OBJC_INTEROP #import #import #include @@ -216,6 +219,7 @@ extern "C" void swift_stdlib_CFSetGetValues(NSSet *NS_RELEASES_ARGUMENT set, CFSetGetValues((__bridge CFSetRef)set, values); swift_unknownRelease(set); } +#endif // ${'Local Variables'}: // eval: (read-only-mode 1) diff --git a/stdlib/public/stubs/UnicodeNormalization.cpp b/stdlib/public/stubs/UnicodeNormalization.cpp index 2033b5b95a039..9dace90e599a8 100644 --- a/stdlib/public/stubs/UnicodeNormalization.cpp +++ b/stdlib/public/stubs/UnicodeNormalization.cpp @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#if !defined(__APPLE__) #include "swift/Basic/Lazy.h" #include "swift/Runtime/Config.h" #include "swift/Runtime/Debug.h" @@ -283,3 +284,5 @@ swift::_swift_stdlib_unicode_strToLower(uint16_t *Destination, } swift::Lazy ASCIICollation::theTable; +#endif +