@@ -69,6 +69,22 @@ pub struct Location {
6969impl Location {
7070 fn new ( module_path : impl Into < Box < str > > ) -> Self {
7171 let module_path = module_path. into ( ) ;
72+
73+ // We don't care about the difference between the different
74+ // DarwinFoundation modules (for now at least).
75+ if let Some ( rest) = module_path. strip_prefix ( "DarwinFoundation." ) {
76+ return Self :: new ( rest) ;
77+ }
78+ if let Some ( rest) = module_path. strip_prefix ( "_DarwinFoundation1." ) {
79+ return Self :: new ( rest) ;
80+ }
81+ if let Some ( rest) = module_path. strip_prefix ( "_DarwinFoundation2." ) {
82+ return Self :: new ( rest) ;
83+ }
84+ if let Some ( rest) = module_path. strip_prefix ( "_DarwinFoundation3." ) {
85+ return Self :: new ( rest) ;
86+ }
87+
7288 let module_path = match & * module_path {
7389 // Remove submodules for Objective-C.
7490 name if name. starts_with ( "ObjectiveC" ) => "ObjectiveC" . into ( ) ,
@@ -83,7 +99,9 @@ impl Location {
8399
84100 // Various macros
85101 name if name. starts_with ( "os_availability" ) => "__builtin__" . into ( ) ,
86- "DarwinFoundation.cdefs" => "__builtin__" . into ( ) ,
102+ name if name. starts_with ( "_AvailabilityInternal" ) => "__builtin__" . into ( ) ,
103+ name if name. starts_with ( "availability" ) => "__builtin__" . into ( ) ,
104+ "cdefs" => "__builtin__" . into ( ) ,
87105 "Darwin.libkern.OSByteOrder" => "__builtin__" . into ( ) ,
88106 "TargetConditionals" => "__builtin__" . into ( ) ,
89107 "Darwin.AssertMacros" => "__builtin__" . into ( ) ,
@@ -108,7 +126,7 @@ impl Location {
108126 "_Builtin_stdint" | "_stdint" => "__builtin__" . into ( ) ,
109127 name if name. starts_with ( "_Builtin_stddef" ) => "__builtin__" . into ( ) ,
110128 // Implementation of the above
111- "DarwinFoundation. types.machine_types" => "__builtin__" . into ( ) ,
129+ name if name . starts_with ( " types.machine_types") => "__builtin__" . into ( ) ,
112130 // UINT_MAX, FLT_MIN, DBL_MAX, etc.
113131 // Handled manually in `expr.rs`.
114132 "_Builtin_limits" => "__builtin__" . into ( ) ,
@@ -132,8 +150,8 @@ impl Location {
132150 name if name. starts_with ( "sys_types" ) => "__libc__" . into ( ) ,
133151 name if name. starts_with ( "Darwin.POSIX" ) => "__libc__" . into ( ) ,
134152 name if name. starts_with ( "_signal" ) => "__libc__" . into ( ) ,
135- "DarwinFoundation. types.sys_types" => "__libc__" . into ( ) ,
136- "DarwinFoundation. qos" => "__libc__" . into ( ) ,
153+ "types.sys_types" => "__libc__" . into ( ) ,
154+ "qos" => "__libc__" . into ( ) ,
137155 "_stdio" => "__libc__" . into ( ) ,
138156 "_time.timespec" => "__libc__" . into ( ) ,
139157 "_fenv" => "__libc__" . into ( ) ,
@@ -149,9 +167,12 @@ impl Location {
149167 "ptrauth" => "__libc__" . into ( ) ,
150168 "Darwin.uuid" => "__libc__" . into ( ) ,
151169 "unistd" => "__libc__" . into ( ) ,
170+ "Darwin.malloc" => "__libc__" . into ( ) ,
171+ "_stdlib.malloc.malloc_type" => "__libc__" . into ( ) ,
152172
153173 // Will be moved to the `mach2` crate in `libc` v1.0
154174 name if name. starts_with ( "Darwin.Mach" ) => "__libc__" . into ( ) ,
175+ "mach.port.mach_port_t" => "__libc__" . into ( ) ,
155176 "mach.mach_port_t" => "__libc__" . into ( ) ,
156177 "_mach_port_t" => "__libc__" . into ( ) ,
157178
@@ -164,6 +185,11 @@ impl Location {
164185 . replace ( "IOBluetoothUI.objc" , "IOBluetoothUI.objc2" )
165186 . into ( ) ,
166187
188+ // TODO: Will hopefully be fixed in future Xcode betas
189+ "_LocationEssentials.CLLocationEssentials" => "CoreLocation.CLLocation" . into ( ) ,
190+ "UIUtilities.UIGeometry" => "UIKit.UIGeometry" . into ( ) ,
191+ "UIUtilities.UICoordinateSpace" => "UIKit.UIView" . into ( ) ,
192+
167193 _ => module_path,
168194 } ;
169195
0 commit comments