Skip to content

Commit 52c27f9

Browse files
committed
---
yaml --- r: 342004 b: refs/heads/rxwei-patch-1 c: 2225cb2 h: refs/heads/master
1 parent 5f05250 commit 52c27f9

25 files changed

+277
-371
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 5fe29a719b0a2367a7a8ec93c92e3b3e54a76734
1018+
refs/heads/rxwei-patch-1: 2225cb2f417fcb80ff31e4e76fbf9ed01c8bdb2f
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/benchmark/Package.swift

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:4.2
22

33
import PackageDescription
44
import Foundation
@@ -9,15 +9,10 @@ unsupportedTests.insert("ObjectiveCBridging")
99
unsupportedTests.insert("ObjectiveCBridgingStubs")
1010
#endif
1111

12-
//===---
13-
// Single Source Libraries
14-
//
15-
16-
/// Return the source files in subDirectory that we will translate into
17-
/// libraries. Each source library will be compiled as its own module.
18-
func getSingleSourceLibraries(subDirectory: String) -> [String] {
12+
// This is a stop gap hack so we can edit benchmarks in Xcode.
13+
let singleSourceLibraries: [String] = {
1914
let f = FileManager.`default`
20-
let dirURL = URL(fileURLWithPath: subDirectory)
15+
let dirURL = URL(fileURLWithPath: "single-source").absoluteURL
2116
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
2217
includingPropertiesForKeys: nil)
2318
return fileURLs.compactMap { (path: URL) -> String? in
@@ -30,45 +25,27 @@ func getSingleSourceLibraries(subDirectory: String) -> [String] {
3025
return nil
3126
}
3227

33-
let name = String(c[0])
28+
let s = String(c[0])
3429

3530
// We do not support this test.
36-
if unsupportedTests.contains(name) {
31+
if unsupportedTests.contains(s) {
3732
return nil
3833
}
3934

40-
return name
35+
assert(s != "PrimsSplit")
36+
return s
4137
}
42-
}
43-
44-
var singleSourceLibraryDirs: [String] = []
45-
singleSourceLibraryDirs.append("single-source")
46-
47-
var singleSourceLibraries: [String] = singleSourceLibraryDirs.flatMap {
48-
getSingleSourceLibraries(subDirectory: $0)
49-
}
38+
}()
5039

51-
//===---
52-
// Multi Source Libraries
53-
//
54-
55-
func getMultiSourceLibraries(subDirectory: String) -> [(String, String)] {
40+
let multiSourceLibraries: [String] = {
5641
let f = FileManager.`default`
57-
let dirURL = URL(string: subDirectory)!
58-
let subDirs = try! f.contentsOfDirectory(at: dirURL, includingPropertiesForKeys: nil)
59-
return subDirs.map { (subDirectory, $0.lastPathComponent) }
60-
}
61-
62-
var multiSourceLibraryDirs: [String] = []
63-
multiSourceLibraryDirs.append("multi-source")
64-
65-
var multiSourceLibraries: [(parentSubDir: String, name: String)] = multiSourceLibraryDirs.flatMap {
66-
getMultiSourceLibraries(subDirectory: $0)
67-
}
68-
69-
//===---
70-
// Products
71-
//
42+
let dirURL = URL(fileURLWithPath: "multi-source").absoluteURL
43+
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
44+
includingPropertiesForKeys: nil)
45+
return fileURLs.map { (path: URL) -> String in
46+
return path.lastPathComponent
47+
}
48+
}()
7249

7350
var products: [Product] = []
7451
products.append(.library(name: "TestsUtils", type: .static, targets: ["TestsUtils"]))
@@ -77,15 +54,9 @@ products.append(.library(name: "DriverUtils", type: .static, targets: ["DriverUt
7754
products.append(.library(name: "ObjectiveCTests", type: .static, targets: ["ObjectiveCTests"]))
7855
#endif
7956
products.append(.executable(name: "SwiftBench", targets: ["SwiftBench"]))
80-
57+
products.append(.library(name: "PrimsSplit", type: .static, targets: ["PrimsSplit"]))
8158
products += singleSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
82-
products += multiSourceLibraries.map {
83-
return .library(name: $0.name, type: .static, targets: [$0.name])
84-
}
85-
86-
//===---
87-
// Targets
88-
//
59+
products += multiSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
8960

9061
var targets: [Target] = []
9162
targets.append(.target(name: "TestsUtils", path: "utils", sources: ["TestsUtils.swift"]))
@@ -102,7 +73,7 @@ swiftBenchDeps.append(.target(name: "ObjectiveCTests"))
10273
#endif
10374
swiftBenchDeps.append(.target(name: "DriverUtils"))
10475
swiftBenchDeps += singleSourceLibraries.map { .target(name: $0) }
105-
swiftBenchDeps += multiSourceLibraries.map { .target(name: $0.name) }
76+
swiftBenchDeps += multiSourceLibraries.map { .target(name: $0) }
10677

10778
targets.append(
10879
.target(name: "SwiftBench",
@@ -121,27 +92,20 @@ var singleSourceDeps: [Target.Dependency] = [.target(name: "TestsUtils")]
12192
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
12293
singleSourceDeps.append(.target(name: "ObjectiveCTests"))
12394
#endif
124-
125-
targets += singleSourceLibraries.map { name in
126-
return .target(name: name,
95+
targets += singleSourceLibraries.map { x in
96+
return .target(name: x,
12797
dependencies: singleSourceDeps,
12898
path: "single-source",
129-
sources: ["\(name).swift"])
99+
sources: ["\(x).swift"])
130100
}
131-
132-
targets += multiSourceLibraries.map { lib in
133-
return .target(
134-
name: lib.name,
101+
targets += multiSourceLibraries.map { x in
102+
return .target(name: x,
135103
dependencies: [
136104
.target(name: "TestsUtils")
137105
],
138-
path: lib.parentSubDir)
106+
path: "multi-source/\(x)")
139107
}
140108

141-
//===---
142-
// Top Level Definition
143-
//
144-
145109
let p = Package(
146110
name: "swiftbench",
147111
products: products,

branches/rxwei-patch-1/benchmark/README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Swift Benchmark Suite
1+
Swift Benchmark Suite
2+
=====================
23

34
This directory contains the Swift Benchmark Suite.
45

5-
## Running Swift Benchmarks
6+
Running Swift Benchmarks
7+
------------------------
68

79
To run Swift benchmarks, pass the `--benchmark` flag to `build-script`. The
810
current benchmark results will be compared to the previous run's results if
@@ -14,7 +16,8 @@ impacting changes, and run the benchmarks again. Upon benchmark completion, the
1416
benchmark results for the development branch will be compared to the most
1517
recent benchmark results for `master`.
1618

17-
## Building with build-script
19+
Building with build-script
20+
--------------------------
1821

1922
By default, Swift benchmarks for OS X are compiled during the Swift build
2023
process. To build Swift benchmarks for additional platforms, pass the following
@@ -30,7 +33,8 @@ drivers dynamically link Swift standard library dylibs from a path
3033
relative to their run-time location (../lib/swift) so the standard
3134
library should be distributed alongside them.
3235

33-
## Building Independently
36+
Building Independently
37+
----------------------
3438

3539
To build the Swift benchmarks using only an Xcode installation: install an
3640
Xcode version with Swift support, install cmake 2.8.12, and ensure Xcode is
@@ -106,7 +110,8 @@ installed libraries instead, enable
106110
This will reflect the performance of the Swift standard library
107111
installed on the device, not the one included in the Swift root.
108112

109-
## Using the Benchmark Driver
113+
Using the Benchmark Driver
114+
--------------------------
110115

111116
### Usage
112117

@@ -149,15 +154,17 @@ You can use test numbers instead of test names like this:
149154
Test numbers are not stable in the long run, adding and removing tests from the
150155
benchmark suite will reorder them, but they are stable for a given build.
151156

152-
## Using the Harness Generator
157+
Using the Harness Generator
158+
---------------------------
153159

154160
`scripts/generate_harness/generate_harness.py` runs `gyb` to automate generation
155161
of some benchmarks.
156162

157163
** FIXME ** `gyb` should be invoked automatically during the
158164
build so that manually invoking `generate_harness.py` is not required.
159165

160-
## Adding New Benchmarks
166+
Adding New Benchmarks
167+
---------------------
161168

162169
The harness generator supports both single and multiple file tests.
163170

@@ -237,8 +244,8 @@ public func run_YourTestName(N: Int) {
237244
The current set of tags are defined by the `BenchmarkCategory` enum in
238245
`TestsUtils.swift` .
239246

240-
## Testing the Benchmark Drivers
241-
247+
Testing the Benchmark Drivers
248+
-----------------------------
242249
When working on tests, after the initial build
243250
````
244251
swift-source$ ./swift/utils/build-script -R -B

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,7 +4120,20 @@ class ProtocolDecl final : public NominalTypeDecl {
41204120
Bits.ProtocolDecl.RequiresClass = requiresClass;
41214121
}
41224122

4123-
bool existentialConformsToSelfSlow();
4123+
/// Returns the cached result of \c existentialConformsToSelf or \c None if it
4124+
/// hasn't yet been computed.
4125+
Optional<bool> getCachedExistentialConformsToSelf() const {
4126+
if (Bits.ProtocolDecl.ExistentialConformsToSelfValid)
4127+
return Bits.ProtocolDecl.ExistentialConformsToSelf;
4128+
4129+
return None;
4130+
}
4131+
4132+
/// Caches the result of \c existentialConformsToSelf
4133+
void setCachedExistentialConformsToSelf(bool result) {
4134+
Bits.ProtocolDecl.ExistentialConformsToSelfValid = true;
4135+
Bits.ProtocolDecl.ExistentialConformsToSelf = result;
4136+
}
41244137

41254138
bool existentialTypeSupportedSlow();
41264139

@@ -4134,6 +4147,7 @@ class ProtocolDecl final : public NominalTypeDecl {
41344147
friend class SuperclassTypeRequest;
41354148
friend class RequirementSignatureRequest;
41364149
friend class ProtocolRequiresClassRequest;
4150+
friend class ExistentialConformsToSelfRequest;
41374151
friend class TypeChecker;
41384152

41394153
public:
@@ -4204,13 +4218,7 @@ class ProtocolDecl final : public NominalTypeDecl {
42044218
/// This is only permitted if there is nothing "non-trivial" that we
42054219
/// can do with the metatype, which means the protocol must not have
42064220
/// any static methods and must be declared @objc.
4207-
bool existentialConformsToSelf() const {
4208-
if (Bits.ProtocolDecl.ExistentialConformsToSelfValid)
4209-
return Bits.ProtocolDecl.ExistentialConformsToSelf;
4210-
4211-
return const_cast<ProtocolDecl *>(this)
4212-
->existentialConformsToSelfSlow();
4213-
}
4221+
bool existentialConformsToSelf() const;
42144222

42154223
/// Does this protocol require a self-conformance witness table?
42164224
bool requiresSelfConformanceWitnessTable() const;

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4523,9 +4523,6 @@ WARNING(property_wrapper_init_initialValue,none,
45234523
())
45244524
ERROR(property_wrapper_projection_value_missing,none,
45254525
"could not find projection value property %0", (Identifier))
4526-
ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter "
4527-
"%0 in property wrapper initializer; add 'wrappedValue' and %0 "
4528-
"arguments in '@%1(...)'", (Identifier, StringRef))
45294526

45304527
//------------------------------------------------------------------------------
45314528
// MARK: function builder diagnostics

branches/rxwei-patch-1/include/swift/AST/TypeCheckRequests.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,32 @@ class ProtocolRequiresClassRequest:
201201
void cacheResult(bool value) const;
202202
};
203203

204+
/// Determine whether an existential conforming to a protocol can be matched
205+
/// with a generic type parameter constrained to that protocol.
206+
class ExistentialConformsToSelfRequest:
207+
public SimpleRequest<ExistentialConformsToSelfRequest,
208+
bool(ProtocolDecl *),
209+
CacheKind::SeparatelyCached> {
210+
public:
211+
using SimpleRequest::SimpleRequest;
212+
213+
private:
214+
friend SimpleRequest;
215+
216+
// Evaluation.
217+
llvm::Expected<bool> evaluate(Evaluator &evaluator, ProtocolDecl *decl) const;
218+
219+
public:
220+
// Cycle handling.
221+
void diagnoseCycle(DiagnosticEngine &diags) const;
222+
void noteCycleStep(DiagnosticEngine &diags) const;
223+
224+
// Separate caching.
225+
bool isCached() const { return true; }
226+
Optional<bool> getCachedResult() const;
227+
void cacheResult(bool value) const;
228+
};
229+
204230
/// Determine whether the given declaration is 'final'.
205231
class IsFinalRequest :
206232
public SimpleRequest<IsFinalRequest,

branches/rxwei-patch-1/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SWIFT_TYPEID(EnumRawTypeRequest)
2020
SWIFT_TYPEID(OverriddenDeclsRequest)
2121
SWIFT_TYPEID(IsObjCRequest)
2222
SWIFT_TYPEID(ProtocolRequiresClassRequest)
23+
SWIFT_TYPEID(ExistentialConformsToSelfRequest)
2324
SWIFT_TYPEID(IsFinalRequest)
2425
SWIFT_TYPEID(IsDynamicRequest)
2526
SWIFT_TYPEID(RequirementRequest)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//===--- Utils.h - Index utilities that are generally useful ----*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef SWIFT_INDEX_UTILS_H
14+
#define SWIFT_INDEX_UTILS_H
15+
16+
#include "swift/Basic/LLVM.h"
17+
#include "llvm/ADT/ArrayRef.h"
18+
#include "llvm/ADT/SmallVector.h"
19+
20+
namespace swift {
21+
class ValueDecl;
22+
23+
/// Collect all the protocol requirements that a given declaration can
24+
/// provide default implementations for. VD is a declaration in extension
25+
/// declaration. Scratch is the buffer to collect those protocol
26+
/// requirements.
27+
///
28+
/// \returns the slice of Scratch
29+
ArrayRef<ValueDecl*>
30+
canDeclProvideDefaultImplementationFor(ValueDecl* VD,
31+
llvm::SmallVectorImpl<ValueDecl*> &Scratch);
32+
33+
/// Get decls that the given decl overrides, protocol requirements that
34+
/// it serves as a default implementation of, and optionally protocol
35+
/// requirements it satisfies in a conforming class
36+
std::vector<ValueDecl*>
37+
getOverriddenDecls(ValueDecl *VD, bool IncludeProtocolRequirements = true,
38+
bool Transitive = false);
39+
40+
} // end namespace swift
41+
#endif // SWIFT_INDEX_UTILS_H

branches/rxwei-patch-1/include/swift/Sema/IDETypeChecking.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,6 @@ namespace swift {
241241
Optional<std::pair<Type, Type>>
242242
getRootAndResultTypeOfKeypathDynamicMember(SubscriptDecl *subscript,
243243
const DeclContext *DC);
244-
/// Collect all the protocol requirements that a given declaration can
245-
/// provide default implementations for. VD is a declaration in extension
246-
/// declaration. Scratch is the buffer to collect those protocol
247-
/// requirements.
248-
///
249-
/// \returns the slice of Scratch
250-
ArrayRef<ValueDecl*>
251-
canDeclProvideDefaultImplementationFor(ValueDecl* VD,
252-
llvm::SmallVectorImpl<ValueDecl*> &Scratch);
253-
254-
/// Get decls that the given decl overrides, protocol requirements that
255-
/// it serves as a default implementation of, and optionally protocol
256-
/// requirements it satisfies in a conforming class
257-
std::vector<ValueDecl*>
258-
collectAllOverriddenDecls(ValueDecl *VD,
259-
bool IncludeProtocolRequirements = true,
260-
bool Transitive = false);
261-
262244
}
263245

264246
#endif

0 commit comments

Comments
 (0)