@@ -161,11 +161,11 @@ static Class getSwiftNativeNSErrorClass() {
161
161
}
162
162
163
163
// / Allocate a catchable error object.
164
- static BoxPair::Return
165
- _swift_allocError_ (const Metadata *type,
166
- const WitnessTable *errorConformance,
167
- OpaqueValue *initialValue,
168
- bool isTake) {
164
+ BoxPair::Return
165
+ swift::swift_allocError (const Metadata *type,
166
+ const WitnessTable *errorConformance,
167
+ OpaqueValue *initialValue,
168
+ bool isTake) {
169
169
auto TheSwiftNativeNSError = getSwiftNativeNSErrorClass ();
170
170
assert (class_getInstanceSize (TheSwiftNativeNSError) == sizeof (SwiftErrorHeader)
171
171
&& " NSError layout changed!" );
@@ -213,30 +213,11 @@ static Class getSwiftNativeNSErrorClass() {
213
213
return BoxPair{reinterpret_cast <HeapObject*>(instance), valuePtr};
214
214
}
215
215
216
- SWIFT_RUNTIME_EXPORT
217
- auto *_swift_allocError = _swift_allocError_;
218
-
219
- BoxPair::Return
220
- swift::swift_allocError (const Metadata *type,
221
- const WitnessTable *errorConformance,
222
- OpaqueValue *value, bool isTake) {
223
- return _swift_allocError (type, errorConformance, value, isTake);
224
- }
225
-
226
216
// / Deallocate an error object whose contained object has already been
227
217
// / destroyed.
228
- static void
229
- _swift_deallocError_ (SwiftError *error,
230
- const Metadata *type) {
231
- object_dispose ((id )error);
232
- }
233
-
234
- SWIFT_RUNTIME_EXPORT
235
- auto *_swift_deallocError = _swift_deallocError_;
236
-
237
218
void
238
219
swift::swift_deallocError (SwiftError *error, const Metadata *type) {
239
- return _swift_deallocError ( error, type );
220
+ object_dispose (( id ) error);
240
221
}
241
222
242
223
static const WitnessTable *getNSErrorConformanceToError () {
@@ -335,10 +316,10 @@ static Class getSwiftNativeNSErrorClass() {
335
316
// / temporary buffer. The implementation may write a reference to itself to
336
317
// / that buffer if the error object is a toll-free-bridged NSError instead of
337
318
// / a native Swift error, in which case the object itself is the "boxed" value.
338
- static void
339
- _swift_getErrorValue_ (const SwiftError *errorObject,
340
- void **scratch,
341
- ErrorValueResult *out) {
319
+ void
320
+ swift::swift_getErrorValue (const SwiftError *errorObject,
321
+ void **scratch,
322
+ ErrorValueResult *out) {
342
323
// TODO: Would be great if Clang had a return-three convention so we didn't
343
324
// need the out parameter here.
344
325
@@ -356,16 +337,6 @@ static Class getSwiftNativeNSErrorClass() {
356
337
}
357
338
}
358
339
359
- SWIFT_RUNTIME_EXPORT
360
- auto *_swift_getErrorValue = _swift_getErrorValue_;
361
-
362
- void
363
- swift::swift_getErrorValue (const SwiftError *errorObject,
364
- void **scratch,
365
- ErrorValueResult *out) {
366
- return _swift_getErrorValue (errorObject, scratch, out);
367
- }
368
-
369
340
// @_silgen_name("swift_stdlib_getErrorDomainNSString")
370
341
// public func _stdlib_getErrorDomainNSString<T : Error>
371
342
// (x: UnsafePointer<T>) -> AnyObject
@@ -414,7 +385,8 @@ typedef SWIFT_CC(swift)
414
385
415
386
// / Take an Error box and turn it into a valid NSError instance.
416
387
SWIFT_CC (swift)
417
- static id _swift_bridgeErrorToNSError_(SwiftError *errorObject) {
388
+ id
389
+ swift::swift_bridgeErrorToNSError(SwiftError *errorObject) {
418
390
auto ns = reinterpret_cast <NSError *>(errorObject);
419
391
420
392
// If we already have a domain set, then we've already initialized.
@@ -475,16 +447,6 @@ static id _swift_bridgeErrorToNSError_(SwiftError *errorObject) {
475
447
return ns;
476
448
}
477
449
478
- SWIFT_CC (swift)
479
- SWIFT_RUNTIME_EXPORT
480
- id (*_swift_bridgeErrorToNSError)(SwiftError*) = _swift_bridgeErrorToNSError_;
481
-
482
- SWIFT_CC (swift)
483
- id
484
- swift::swift_bridgeErrorToNSError(SwiftError *errorObject) {
485
- return _swift_bridgeErrorToNSError (errorObject);
486
- }
487
-
488
450
bool
489
451
swift::tryDynamicCastNSErrorToValue (OpaqueValue *dest,
490
452
OpaqueValue *src,
@@ -562,37 +524,23 @@ bool BridgeFn(NSError *, OpaqueValue*, const Metadata *,
562
524
return false ;
563
525
}
564
526
565
- static SwiftError *_swift_errorRetain_ (SwiftError *error) {
527
+ SwiftError *
528
+ swift::swift_errorRetain (SwiftError *error) {
566
529
// For now, SwiftError is always objc-refcounted.
567
530
return (SwiftError*)objc_retain ((id )error);
568
531
}
569
532
570
- SWIFT_RUNTIME_EXPORT
571
- auto *_swift_errorRetain = _swift_errorRetain_;
572
-
573
- SwiftError *swift::swift_errorRetain (SwiftError *error) {
574
- return _swift_errorRetain (error);
575
- }
576
-
577
- static void _swift_errorRelease_ (SwiftError *error) {
533
+ void
534
+ swift::swift_errorRelease (SwiftError *error) {
578
535
// For now, SwiftError is always objc-refcounted.
579
536
return objc_release ((id )error);
580
537
}
581
538
582
- SWIFT_RUNTIME_EXPORT
583
- auto *_swift_errorRelease = _swift_errorRelease_;
584
-
585
- void swift::swift_errorRelease (SwiftError *error) {
586
- return _swift_errorRelease (error);
539
+ // / Breakpoint hook for debuggers.
540
+ void
541
+ swift::swift_willThrow (SwiftError *error) {
542
+ // empty
587
543
}
588
544
589
- static void _swift_willThrow_ (SwiftError *error) { }
590
-
591
- SWIFT_RUNTIME_EXPORT
592
- auto *_swift_willThrow = _swift_willThrow_;
593
-
594
- void swift::swift_willThrow (SwiftError *error) {
595
- return _swift_willThrow (error);
596
- }
597
545
#endif
598
546
0 commit comments