mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use the generic type lowering algorithm described in "docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion type to the type expected by the ABI. Change IRGen to use the swift calling convention (swiftcc) for native swift functions. Use the 'swiftself' attribute on self parameters and for closures contexts. Use the 'swifterror' parameter for swift error parameters. Change functions in the runtime that are called as native swift functions to use the swift calling convention. rdar://19978563
66 lines
2.5 KiB
Objective-C
66 lines
2.5 KiB
Objective-C
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#include "swift/Runtime/Config.h"
|
|
|
|
SWIFT_CC(swift)
|
|
extern /*"C"*/ NS_RETURNS_RETAINED id
|
|
NS_Swift_NSFileManager_replaceItemAtURL_withItemAtURL_backupItemName_options(
|
|
NSFileManager *NS_RELEASES_ARGUMENT _Nonnull self_,
|
|
NSURL *NS_RELEASES_ARGUMENT _Nonnull originalItemURL,
|
|
NSURL *NS_RELEASES_ARGUMENT _Nonnull newItemURL,
|
|
NSString *NS_RELEASES_ARGUMENT _Nullable backupItemName, NSUInteger options,
|
|
NSError *_Nullable *_Nullable error) {
|
|
|
|
NSURL *result = nil;
|
|
BOOL success = [self_ replaceItemAtURL:originalItemURL
|
|
withItemAtURL:newItemURL
|
|
backupItemName:backupItemName
|
|
options:(NSFileManagerItemReplacementOptions)options
|
|
resultingItemURL:&result
|
|
error:error];
|
|
[self_ release];
|
|
[originalItemURL release];
|
|
[newItemURL release];
|
|
[backupItemName release];
|
|
return success ? [result retain] : nil;
|
|
}
|
|
|
|
extern /*"C"*/ NS_RETURNS_RETAINED id
|
|
NS_Swift_NSFileManager_enumeratorAt_includingPropertiesForKeys_options_errorHandler(
|
|
NSFileManager *NS_RELEASES_ARGUMENT _Nonnull self_,
|
|
NSURL *NS_RELEASES_ARGUMENT _Nonnull url,
|
|
NSArray *NS_RELEASES_ARGUMENT _Nullable keys,
|
|
NSUInteger options,
|
|
BOOL (^_Nonnull errorHandler)(NSURL * _Nonnull url, NSError * _Nonnull error) ) {
|
|
|
|
NSDirectoryEnumerator *result = [self_ enumeratorAtURL:url
|
|
includingPropertiesForKeys:keys
|
|
options:(NSDirectoryEnumerationOptions)options
|
|
errorHandler:^(NSURL * url, NSError *error) {
|
|
|
|
NSURL *realURL = url ?: error.userInfo[NSURLErrorKey];
|
|
if (!realURL) {
|
|
NSString *path = error.userInfo[NSFilePathErrorKey];
|
|
realURL = [NSURL fileURLWithPath:path];
|
|
}
|
|
return errorHandler(realURL, error);
|
|
|
|
}];
|
|
[self_ release];
|
|
[url release];
|
|
[keys release];
|
|
[errorHandler release];
|
|
return [result retain];
|
|
}
|