Skip to content

Commit 7699ffd

Browse files
committed
---
yaml --- r: 345519 b: refs/heads/master c: 9a2bf8d h: refs/heads/master i: 345517: b8f6fb9 345515: e85c26f 345511: a4b743a 345503: 49f3d78
1 parent 60c4f10 commit 7699ffd

File tree

12 files changed

+30
-435
lines changed

12 files changed

+30
-435
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fa37884515e0ac7b3d3f9634e6dec7b2acbbdbaf
2+
refs/heads/master: 9a2bf8d4f89a221ef8c30847e22983708a7d3cd0
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/FrontendTool/ReferenceDependencies.cpp

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "swift/AST/NameLookup.h"
2323
#include "swift/AST/ReferencedNameTracker.h"
2424
#include "swift/AST/Types.h"
25+
#include "swift/Basic/FileSystem.h"
2526
#include "swift/Basic/LLVM.h"
2627
#include "swift/Basic/ReferenceDependencyKeys.h"
2728
#include "swift/Frontend/FrontendOptions.h"
@@ -65,11 +66,6 @@ class ReferenceDependenciesEmitter {
6566
llvm::raw_ostream &out);
6667

6768
private:
68-
/// Opens file for reference dependencies. Emits diagnostic if needed.
69-
///
70-
/// \return nullptr on error
71-
static std::unique_ptr<llvm::raw_fd_ostream> openFile(DiagnosticEngine &diags,
72-
StringRef OutputPath);
7369
/// Emits all the dependency information.
7470
void emit() const;
7571

@@ -189,35 +185,24 @@ static std::string escape(DeclBaseName name) {
189185
return llvm::yaml::escape(name.userFacingName());
190186
}
191187

192-
std::unique_ptr<llvm::raw_fd_ostream>
193-
ReferenceDependenciesEmitter::openFile(DiagnosticEngine &diags,
194-
StringRef outputPath) {
188+
bool ReferenceDependenciesEmitter::emit(DiagnosticEngine &diags,
189+
SourceFile *const SF,
190+
const DependencyTracker &depTracker,
191+
StringRef outputPath) {
195192
// Before writing to the dependencies file path, preserve any previous file
196193
// that may have been there. No error handling -- this is just a nicety, it
197194
// doesn't matter if it fails.
198195
llvm::sys::fs::rename(outputPath, outputPath + "~");
199-
200-
std::error_code EC;
201-
auto out = llvm::make_unique<llvm::raw_fd_ostream>(outputPath, EC,
202-
llvm::sys::fs::F_None);
203-
204-
if (out->has_error() || EC) {
196+
std::error_code EC =
197+
swift::atomicallyWritingToFile(outputPath,
198+
[&](llvm::raw_pwrite_stream &out) {
199+
ReferenceDependenciesEmitter::emit(SF, depTracker, out);
200+
});
201+
if (EC) {
205202
diags.diagnose(SourceLoc(), diag::error_opening_output, outputPath,
206203
EC.message());
207-
out->clear_error();
208-
return nullptr;
209-
}
210-
return out;
211-
}
212-
213-
bool ReferenceDependenciesEmitter::emit(DiagnosticEngine &diags,
214-
SourceFile *const SF,
215-
const DependencyTracker &depTracker,
216-
StringRef outputPath) {
217-
const std::unique_ptr<llvm::raw_ostream> out = openFile(diags, outputPath);
218-
if (!out.get())
219204
return true;
220-
ReferenceDependenciesEmitter::emit(SF, depTracker, *out);
205+
}
221206
return false;
222207
}
223208

trunk/stdlib/public/SDK/Foundation/Boxing.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,3 @@ extension _MutableBoxing {
6262
return whatToDo(_handle._pointer)
6363
}
6464
}
65-
66-
internal enum _MutableUnmanagedWrapper<ImmutableType : NSObject, MutableType : NSObject>
67-
where MutableType : NSMutableCopying{
68-
case Immutable(Unmanaged<ImmutableType>)
69-
case Mutable(Unmanaged<MutableType>)
70-
}

trunk/stdlib/public/SDK/Foundation/Decimal.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@_exported import Foundation // Clang module
1414
import _SwiftCoreFoundationOverlayShims
1515

16+
// The methods in this extension exist to match the protocol requirements of FloatinPoint, even if we can't conform directly.
17+
// If it becomes clear that conformance is truly impossible, we can deprecate some of the methods (e.g. isEqual(to:)) in favor of operators.
1618
extension Decimal {
1719
public typealias RoundingMode = NSDecimalNumber.RoundingMode
1820
public typealias CalculationError = NSDecimalNumber.CalculationError

trunk/stdlib/public/SDK/Foundation/NSCoder.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,3 @@ extension NSKeyedUnarchiver {
229229
}
230230
}
231231
}
232-
233-
234-
@available(*, deprecated, renamed:"NSCoding", message: "Please use NSCoding")
235-
typealias Coding = NSCoding
236-
237-
@available(*, deprecated, renamed:"NSCoder", message: "Please use NSCoder")
238-
typealias Coder = NSCoder
239-
240-
@available(*, deprecated, renamed:"NSKeyedUnarchiver", message: "Please use NSKeyedUnarchiver")
241-
typealias KeyedUnarchiver = NSKeyedUnarchiver
242-
243-
@available(*, deprecated, renamed:"NSKeyedArchiver", message: "Please use NSKeyedArchiver")
244-
typealias KeyedArchiver = NSKeyedArchiver

trunk/stdlib/public/SDK/Foundation/NSDictionary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension Dictionary {
3434
///
3535
/// The provided `NSDictionary` will be copied to ensure that the copy can
3636
/// not be mutated by other code.
37-
public init(_cocoaDictionary: __shared _NSDictionary) {
37+
fileprivate init(_cocoaDictionary: __shared _NSDictionary) {
3838
assert(
3939
_isBridgedVerbatimToObjectiveC(Key.self) &&
4040
_isBridgedVerbatimToObjectiveC(Value.self),

trunk/stdlib/public/SDK/Foundation/NSGeometry.swift

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,15 @@ import CoreGraphics
2020
// NSRectEdge
2121
//===----------------------------------------------------------------------===//
2222

23-
// In the SDK, the following NS*Edge constants are defined as macros for the
24-
// corresponding CGRectEdge enumerators. Thus, in the SDK, NS*Edge constants
25-
// have CGRectEdge type. This is not correct for Swift (as there is no
26-
// implicit conversion to NSRectEdge).
27-
28-
@available(*, unavailable, renamed: "NSRectEdge.MinX")
29-
public var NSMinXEdge: NSRectEdge {
30-
fatalError("unavailable property can't be accessed")
31-
}
32-
@available(*, unavailable, renamed: "NSRectEdge.MinY")
33-
public var NSMinYEdge: NSRectEdge {
34-
fatalError("unavailable property can't be accessed")
35-
}
36-
@available(*, unavailable, renamed: "NSRectEdge.MaxX")
37-
public var NSMaxXEdge: NSRectEdge {
38-
fatalError("unavailable property can't be accessed")
39-
}
40-
@available(*, unavailable, renamed: "NSRectEdge.MaxY")
41-
public var NSMaxYEdge: NSRectEdge {
42-
fatalError("unavailable property can't be accessed")
43-
}
44-
4523
extension NSRectEdge {
24+
@inlinable
4625
public init(rectEdge: CGRectEdge) {
4726
self = NSRectEdge(rawValue: UInt(rectEdge.rawValue))!
4827
}
4928
}
5029

5130
extension CGRectEdge {
31+
@inlinable
5232
public init(rectEdge: NSRectEdge) {
5333
self = CGRectEdge(rawValue: UInt32(rectEdge.rawValue))!
5434
}

trunk/stdlib/public/SDK/Foundation/NSIndexSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@_exported import Foundation // Clang module
1414

15-
// FIXME: move inside NSIndexSet when the compiler supports this.
15+
// TODO: Evaluate deprecating with a message in favor of IndexSet.
1616
public struct NSIndexSetIterator : IteratorProtocol {
1717
public typealias Element = Int
1818

trunk/stdlib/public/SDK/Foundation/NSObject.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
@_exported import Foundation // Clang module
1414
import ObjectiveC
1515

16+
// This exists to allow for dynamic dispatch on KVO methods added to NSObject.
17+
// Extending NSObject with these methods would disallow overrides.
1618
public protocol _KeyValueCodingAndObserving {}
19+
extension NSObject : _KeyValueCodingAndObserving {}
1720

1821
public struct NSKeyValueObservedChange<Value> {
1922
public typealias Kind = NSKeyValueChange
@@ -230,5 +233,3 @@ extension _KeyValueCodingAndObserving {
230233
(self as! NSObject).didChangeValue(forKey: _bridgeKeyPathToString(keyPath), withSetMutation: mutation, using: set)
231234
}
232235
}
233-
234-
extension NSObject : _KeyValueCodingAndObserving {}

trunk/stdlib/public/SDK/Foundation/NSSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension Set {
1717
///
1818
/// The provided `NSSet` will be copied to ensure that the copy can
1919
/// not be mutated by other code.
20-
public init(_cocoaSet: __shared _NSSet) {
20+
fileprivate init(_cocoaSet: __shared _NSSet) {
2121
assert(_isBridgedVerbatimToObjectiveC(Element.self),
2222
"Set can be backed by NSSet _variantStorage only when the member type can be bridged verbatim to Objective-C")
2323
// FIXME: We would like to call CFSetCreateCopy() to avoid doing an

0 commit comments

Comments
 (0)