Skip to content

Update swift-3.0-preview-5-branch to build with Xcode 8 beta 5, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. #4211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions apinotes/CoreGraphics.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,6 @@ Enumerators:
SwiftName: CGColorRenderingIntent.saturation
- Name: kCGMomentumScrollPhaseContinue
SwiftName: CGMomentumScrollPhase.continuous
- Name: kCGColorSpaceModelRGB
SwiftName: CGColorSpaceModel.rgb
- Name: kCGColorSpaceModelCMYK
SwiftName: CGColorSpaceModel.cmyk

# CGContext
- Name: kCGBlendModeXOR
SwiftName: CGBlendMode.xor
Expand Down
13 changes: 6 additions & 7 deletions stdlib/public/SDK/CoreGraphics/CoreGraphics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ import Darwin
//===----------------------------------------------------------------------===//

extension CGColor {
@available(OSX 10.3, iOS 2.0, *)
public var components: [CGFloat]? {
guard let pointer = self.__unsafeComponents else { return nil }
let buffer = UnsafeBufferPointer(start: pointer, count: self.numberOfComponents)
return Array(buffer)
}

#if os(macOS)
public class var white: CGColor
{ return CGColor.__constantColor(for: CGColor.__whiteColorName)! }
public class var white: CGColor { return CGColor.__constantColor(for: CGColor.__whiteColorName)! }

public class var black: CGColor
{ return CGColor.__constantColor(for: CGColor.__blackColorName)! }
public class var black: CGColor { return CGColor.__constantColor(for: CGColor.__blackColorName)! }

public class var clear: CGColor
{ return CGColor.__constantColor(for: CGColor.__clearColorName)! }
public class var clear: CGColor { return CGColor.__constantColor(for: CGColor.__clearColorName)! }
#endif
}

Expand Down Expand Up @@ -219,4 +217,5 @@ extension CGAffineTransform {
@_transparent // @fragile
get { return CGAffineTransform(a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0) }
}
}
}

25 changes: 3 additions & 22 deletions test/ClangModules/CoreGraphics_test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@ import CoreGraphics

// REQUIRES: OS=macosx

// CHECK: [[SWITCHTABLE:@.*]] = private unnamed_addr constant [8 x i64] [i64 0, i64 12, i64 23, i64 34, i64 45, i64 55, i64 67, i64 71]

// CHECK-LABEL: define i64 {{.*}}testEnums{{.*}} {
public func testEnums(_ model: CGColorSpaceModel) -> Int {
switch model {
case .unknown : return 0
case .monochrome : return 12
case .rgb : return 23
case .cmyk : return 34
case .lab : return 45
case .deviceN : return 55
case .indexed : return 67
case .pattern : return 71

default: return 0
}
// CHECK: [[GEP:%.+]] = getelementptr inbounds [8 x i64], [8 x i64]* [[SWITCHTABLE]], i64 0, i64 %{{.*}}
// CHECK: [[LOAD:%.+]] = load i64, i64* [[GEP]], align 8
// CHECK: ret i64 [[LOAD]]
}

// CHECK-LABEL: define void {{.*}}rotationAround{{.*}} {
// Get a transform that will rotate around a given offset
public func rotationAround(offset: CGPoint, angle: CGFloat,
Expand Down Expand Up @@ -113,8 +92,10 @@ public func testRenames(transform: CGAffineTransform, context: CGContext,
// CHECK: call void @CGContextTranslateCTM(%struct.CGContext* [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}})

context.clip(to: rect)
context.clip(to: &rect, count: 2)
context.clip(to: rect, mask: image)
// CHECK: call void @CGContextClipToRect(%struct.CGContext* [[CONTEXT]], %struct.CGRect* byval nonnull align 8 %{{.*}})
// CHECK: call void @CGContextClipToRects(%struct.CGContext* [[CONTEXT]], %struct.CGRect* nonnull %{{.*}}, i64 2)
// CHECK: call void @CGContextClipToMask(%struct.CGContext* [[CONTEXT]], %struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGImage* %{{.*}})

var slice = CGRect.zero
Expand All @@ -123,7 +104,7 @@ public func testRenames(transform: CGAffineTransform, context: CGContext,
from: edge)
assert((slice, remainder) == rect.divided(atDistance: CGFloat(2.0),
from: edge))
// CHECK: call void @CGRectDivide(%struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGRect* nonnull %{{.*}}, %struct.CGRect* nonnull %{{.*}}, double {{2\.0+.*}}, i32 %{{.*}})
// CHECK: call void @CGRectDivide(%struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGRect* nonnull %slice, %struct.CGRect* nonnull %remainder, double {{2\.0+.*}}, i32 %{{.*}})
//
// CHECK: ret void
}
Expand Down
7 changes: 2 additions & 5 deletions tools/swift-reflection-test/swift-reflection-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,21 +421,18 @@ int doDumpHeapInstance(const char *BinaryFilename) {
return EXIT_SUCCESS;
break;
case Existential: {
static const char Name[] = "_TtP_";
swift_typeref_t AnyTR
= swift_reflection_typeRefForMangledTypeName(RC,
Name, sizeof(Name)-1);
= swift_reflection_typeRefForMangledTypeName(RC, "_TtP_", 5);

printf("Reflecting an existential.\n");
if (!reflectExistential(RC, Pipe, AnyTR))
return EXIT_SUCCESS;
break;
}
case ErrorExistential: {
static const char ErrorName[] = "_TtPs5Error_";
swift_typeref_t ErrorTR
= swift_reflection_typeRefForMangledTypeName(RC,
ErrorName, sizeof(ErrorName)-1);
"_TtPs5Error_", 21);
printf("Reflecting an error existential.\n");
if (!reflectExistential(RC, Pipe, ErrorTR))
return EXIT_SUCCESS;
Expand Down