File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -983,7 +983,7 @@ extension _StringObject {
983
983
#if !$Embedded
984
984
return _unsafeUncheckedDowncast ( storage, to: __StringStorage. self)
985
985
#else
986
- return unsafeBitCast ( _nativeObject ( toNative : storage) , to : __StringStorage . self )
986
+ return Builtin . castFromNativeObject ( storage)
987
987
#endif
988
988
#else
989
989
#error("Unknown platform")
@@ -1022,7 +1022,7 @@ extension _StringObject {
1022
1022
#if !$Embedded
1023
1023
return _unsafeUncheckedDowncast ( storage, to: __SharedStringStorage. self)
1024
1024
#else
1025
- return unsafeBitCast ( _nativeObject ( toNative : storage) , to : __SharedStringStorage . self )
1025
+ return Builtin . castFromNativeObject ( storage)
1026
1026
#endif
1027
1027
#else
1028
1028
#error("Unknown platform")
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded
2
+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded -O
3
+ // RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded -Osize
4
+
5
+ // REQUIRES: swift_in_compiler
6
+ // REQUIRES: OS=macosx || OS=linux-gnu
7
+ // REQUIRES: CODEGENERATOR=ARM
8
+
9
+ @main
10
+ struct Main {
11
+ static func main( ) {
12
+ let n = 42
13
+ let m = - 42
14
+ let s = " str "
15
+ let str = " Hello \( s) \( n) \( s) \( m) "
16
+ print ( str)
17
+
18
+ print ( " hex: \( hex: 42 ) " )
19
+ print ( " ptr: \( UnsafeRawPointer ( bitPattern: UInt ( 0xffff0000 ) ) !) " )
20
+ }
21
+ }
22
+
23
+ extension DefaultStringInterpolation {
24
+ mutating func appendInterpolation( hex value: Int ) {
25
+ appendInterpolation ( " 0x " + String( value, radix: 16 ) )
26
+ }
27
+
28
+ mutating func appendInterpolation( _ value: UnsafeRawPointer ) {
29
+ appendInterpolation ( " 0x " + String( UInt ( bitPattern: value) , radix: 16 ) )
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments