Skip to content

Commit 6bb0b4c

Browse files
committed
---
yaml --- r: 327661 b: refs/heads/tensorflow c: 8751693 h: refs/heads/master i: 327659: 07635b5
1 parent 6f53819 commit 6bb0b4c

File tree

56 files changed

+339
-633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+339
-633
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: fa74c2f4c0dd97763314b979fd98e4c46fdf8918
819+
refs/heads/tensorflow: 87516934cd8d9fe7c1f38b54cca5a02a17eed45a
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
| **OS** | **Architecture** | **Build** |
1616
|---|:---:|:---:|
17+
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
18+
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
19+
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
1720
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
1821
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
1922
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|

branches/tensorflow/docs/CToSwiftNameTranslation.md

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@
22

33
This document gives a high-level description of how C and Objective-C declarations are translated to Swift, with particular focus on how names are adjusted. It is not attempting to be a *complete* description of everything the compiler does except with regards to how *names* are transformed; even there, some special cases that only apply to Apple's SDKs have been omitted.
44

5-
## Word boundaries
6-
7-
Several forms of name translation are defined in terms of word boundaries. The word-splitting algorithm used by the Swift compiler is as follows: there is a boundary after
8-
9-
1. An underscore ("\_").
10-
2. A series of two or more uppercase ASCII characters and the suffix "s", "es", or "ies" (e.g. "URLs", "VAXes")...unless the last uppercase letter is "I" and the suffix is "s", in which case it's just as likely to be an acronym followed by "Is" (i.e. "URLIs" is treated as "URL Is").
11-
2. A series of two or more uppercase ASCII characters followed by an uppercase ASCII character and then a lowercase ASCII character ("XMLReader" becomes "XML Reader").
12-
3. A series of two or more uppercase ASCII characters followed by a non-ASCII-alphabetic character. ("UTF8" becomes "UTF 8")
13-
4. A series of two or more uppercase ASCII characters at the end of the string.
14-
5. An uppercase ASCII character and any number of non-ASCII-uppercase, non-underscore characters ("ContrivedExample" becomes "Contrived Example").
15-
6. Any number of non-ASCII-uppercase, non-underscore characters ("lowercase\_example" becomes "lowercase \_ example").
16-
17-
185
## Enums
196

207
1. Anonymous? Import elements as constants of the underlying type, *except* that Int is used for an inferred underlying type if all the cases fit in an Int32, since integer conversions are explicit in Swift.
@@ -127,7 +114,15 @@ In C, enumerators (enum cases) aren't namespaced under their enum type, so their
127114

128115
1. Collect all *available, non-deprecated* enum cases *without custom names.* If there are no such cases, collect all cases without custom names, whether available or not.
129116

130-
2. Find the common word-boundary prefix __CP__ of these cases.
117+
2. Find the common word-boundary prefix __CP__ of these cases. There is a word boundary after
118+
119+
1. An underscore ("\_").
120+
2. A series of two or more uppercase ASCII characters and the suffix "s", "es", or "ies" (e.g. "URLs", "VAXes")...unless the last uppercase letter is "I" and the suffix is "s", in which case it's just as likely to be an acronym followed by "Is" (i.e. "URLIs" is treated as "URL Is").
121+
2. A series of two or more uppercase ASCII characters followed by an uppercase ASCII character and then a lowercase ASCII character ("XMLReader" becomes "XML Reader").
122+
3. A series of two or more uppercase ASCII characters followed by a non-ASCII-alphabetic character. ("UTF8" becomes "UTF 8")
123+
4. A series of two or more uppercase ASCII characters at the end of the string.
124+
5. An uppercase ASCII character and any number of non-ASCII-uppercase, non-underscore characters ("ContrivedExample" becomes "Contrived Example").
125+
6. Any number of non-ASCII-uppercase, non-underscore characters ("lowercase\_example" becomes "lowercase \_ example").
131126

132127
3. If __CP__ starts with "k" followed by an uppercase letter, or if it's *just* "k" and none of the cases have a non-identifier-start character immediately after the 'k', treat that as meaning "constant" and ignore it for the next step.
133128

@@ -149,7 +144,7 @@ In C, enumerators (enum cases) aren't namespaced under their enum type, so their
149144

150145
9. ASCII-lowercase the first word of the remaining name if it starts with an uppercase ASCII character.
151146

152-
_There's a bug in this step where the special case for "Is" is missing, so "URLIs" will be lowercased to "urlis"._
147+
_There's a bug here where the special case for "Is" is missing, so "URLIs" will be lowercased to "urlis"._
153148

154149
## `swift_wrapper` typedefs
155150

@@ -195,48 +190,4 @@ extension SecretResourceID {
195190

196191
On Apple platforms, whenever Foundation is imported, constants with the type "NSNotificationName" additionally have the suffix "Notification" stripped before performing the above rules unless they have a custom name. Global NSString constants whose name ends in "Notification" will also automatically be treated as if they were declared with the type NSNotificationName unless they have a custom name.
197192

198-
199-
## Objective-C Protocols
200-
201-
Protocols in Objective-C are normally in a separate namespace from the "ordinary" identifier namespace used by typedefs and classes. Swift does not have separate namespaces, so if the protocol has the same name as another declaration in the same module, the suffix "Protocol" is appended. (Example: NSObjectProtocol in the ObjectiveC module.)
202-
203-
204-
## CF Types
205-
206-
"Core Foundation" is a C-based object-oriented system with strong conventions built around pointers to opaque structs. Creating new Core Foundation types is not generally supported, but Swift will recognize those in Apple's SDKs. If a struct has the `objc_bridge`, `objc_mutable_bridge`, or `objc_bridge_related` Clang attributes, it will be treated as a CF type and a typedef of a pointer to that struct will be imported as a class in Swift. The suffix "Ref" will be dropped from the class's name if present unless doing so would conflict with another declaration in the same module as the typedef.
207-
208-
If the class name contains the word "Mutable" exactly once per the usual word-boundary rules, a corresponding class name without the word "Mutable" will be used as the superclass if present. Otherwise, the CF type is taken to be a root object.
209-
210-
Additionally, typedefs for `void *` or `const void *` that are themselves annotated with `objc_bridge` will be treated as CFTypeRef-like and imported as `Any` rather than `Unsafe[Mutable]RawPointer`.
211-
212-
If a typedef's underlying type is itself a "CF pointer" typedef, the "alias" typedef will be imported as a regular typealias, with the suffix "Ref" still dropped from its name (if present) unless doing so would conflict with another declaration in the same module as the typedef.
213-
214-
215-
## `swift_private`
216-
217-
The `swift_private` Clang attribute prepends `__` onto the base name of any declaration being imported except initializers. For initializers with no arguments, a dummy `Void` argument with the name `__` is inserted; otherwise, the label for the first argument has `__` prepended. This transformation takes place after any other name manipulation, unless the declaration has a custom name. It will not occur if the declaration is an override; in that case the name needs to match the overridden declaration.
218-
219-
```objc
220-
@interface Example : NSObject
221-
- (instancetype)initWithValue:(int)value __attribute__((swift_private));
222-
@property(readonly) int value __attribute__((swift_private));
223-
@end
224-
225-
// Usually seen as NS_REFINED_FOR_SWIFT
226-
```
227-
228-
```swift
229-
class Example: NSObject {
230-
init(__value: Int32)
231-
var __value: Int32 { get }
232-
}
233-
```
234-
235-
The purpose of this annotation is to allow a more idiomatic implementation to be provided in Swift. The effect of `swift_private` is inherited from an enum onto its elements if the enum is not imported as an error code enum, an `@objc` enum, or an option set.
236-
237-
_The original intent of the `swift_private` attribute was additionally to limit access to a Swift module with the same name as the owning Clang module, e.g. the Swift half of a mixed-source framework. However, this restriction has not been implemented as of Swift 5.1._
238-
239-
_For "historical reasons", the `swift_private` attribute is ignored on factory methods with no arguments imported as initializers. This is essentially matching the behavior of older Swift compilers for source compatibility in case someone has marked such a factory method as `swift_private`._
240-
241-
242193
## More to come...

branches/tensorflow/include/swift/AST/Attr.def

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,11 @@ DECL_ATTR(available, Available,
121121
1)
122122
CONTEXTUAL_SIMPLE_DECL_ATTR(final, Final,
123123
OnClass | OnFunc | OnAccessor | OnVar | OnSubscript |
124-
DeclModifier | ABIBreakingToAdd | ABIBreakingToRemove |
125-
APIBreakingToAdd,
124+
DeclModifier,
126125
2)
127126
DECL_ATTR(objc, ObjC,
128127
OnAbstractFunction | OnClass | OnProtocol | OnExtension | OnVar |
129-
OnSubscript | OnEnum | OnEnumElement | ABIBreakingToAdd | ABIBreakingToRemove,
128+
OnSubscript | OnEnum | OnEnumElement,
130129
3)
131130
CONTEXTUAL_SIMPLE_DECL_ATTR(required, Required,
132131
OnConstructor |
@@ -188,7 +187,7 @@ DECL_ATTR(_semantics, Semantics,
188187
21)
189188
CONTEXTUAL_SIMPLE_DECL_ATTR(dynamic, Dynamic,
190189
OnFunc | OnAccessor | OnVar | OnSubscript | OnConstructor |
191-
DeclModifier | ABIBreakingToAdd | ABIBreakingToRemove,
190+
DeclModifier,
192191
22)
193192
CONTEXTUAL_SIMPLE_DECL_ATTR(infix, Infix,
194193
OnFunc | OnOperator |
@@ -213,7 +212,7 @@ SIMPLE_DECL_ATTR(nonobjc, NonObjC,
213212
30)
214213
SIMPLE_DECL_ATTR(_fixed_layout, FixedLayout,
215214
OnVar | OnClass | OnStruct |
216-
UserInaccessible | ABIBreakingToAdd | ABIBreakingToRemove,
215+
UserInaccessible,
217216
31)
218217
SIMPLE_DECL_ATTR(inlinable, Inlinable,
219218
OnVar | OnSubscript | OnAbstractFunction,
@@ -363,7 +362,7 @@ SIMPLE_DECL_ATTR(_weakLinked, WeakLinked,
363362
OnSubscript | OnConstructor | OnEnumElement | OnExtension | UserInaccessible,
364363
75)
365364
SIMPLE_DECL_ATTR(frozen, Frozen,
366-
OnEnum | OnStruct | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToRemove,
365+
OnEnum | OnStruct,
367366
76)
368367
DECL_ATTR_ALIAS(_frozen, Frozen)
369368
SIMPLE_DECL_ATTR(_forbidSerializingReference, ForbidSerializingReference,

branches/tensorflow/include/swift/AST/Attr.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,6 @@ class DeclAttribute : public AttributeBase {
353353

354354
/// Whether client code cannot use the attribute.
355355
UserInaccessible = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 7),
356-
357-
/// Whether adding this attribute can break API
358-
APIBreakingToAdd = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 8),
359-
360-
/// Whether removing this attribute can break API
361-
APIBreakingToRemove = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 9),
362-
363-
/// Whether adding this attribute can break ABI
364-
ABIBreakingToAdd = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 10),
365-
366-
/// Whether removing this attribute can break ABI
367-
ABIBreakingToRemove = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 11),
368356
};
369357

370358
LLVM_READNONE
@@ -447,21 +435,6 @@ class DeclAttribute : public AttributeBase {
447435
return getOptions(DK) & UserInaccessible;
448436
}
449437

450-
static bool isAddingBreakingABI(DeclAttrKind DK) {
451-
return getOptions(DK) & ABIBreakingToAdd;
452-
}
453-
454-
static bool isAddingBreakingAPI(DeclAttrKind DK) {
455-
return getOptions(DK) & APIBreakingToAdd;
456-
}
457-
458-
static bool isRemovingBreakingABI(DeclAttrKind DK) {
459-
return getOptions(DK) & ABIBreakingToRemove;
460-
}
461-
static bool isRemovingBreakingAPI(DeclAttrKind DK) {
462-
return getOptions(DK) & APIBreakingToRemove;
463-
}
464-
465438
bool isDeclModifier() const {
466439
return isDeclModifier(getKind());
467440
}

branches/tensorflow/include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ ERROR(new_decl_without_intro,none,"%0 is a new API without @available attribute"
9898

9999
ERROR(objc_name_change,none,"%0 has ObjC name change from %1 to %2", (StringRef, StringRef, StringRef))
100100

101-
ERROR(desig_init_added,none,"%0 has been added as a designated initializer to an open class", (StringRef))
102-
103101
#ifndef DIAG_NO_UNDEF
104102
# if defined(DIAG)
105103
# undef DIAG

branches/tensorflow/include/swift/AST/ImportCache.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,52 @@ class alignas(ModuleDecl::ImportedModule) ImportCache {
140140
return !getAllVisibleAccessPaths(mod, dc).empty();
141141
}
142142

143+
/// Determines if 'mod' is visible from 'dc' as a result of a scoped import.
144+
/// Note that if 'mod' was not imported from 'dc' at all, this also returns
145+
/// false.
146+
bool isScopedImport(const ModuleDecl *mod, DeclBaseName name,
147+
const DeclContext *dc) {
148+
auto accessPaths = getAllVisibleAccessPaths(mod, dc);
149+
for (auto accessPath : accessPaths) {
150+
if (accessPath.empty())
151+
continue;
152+
if (ModuleDecl::matchesAccessPath(accessPath, name))
153+
return true;
154+
}
155+
156+
return false;
157+
}
158+
143159
/// Returns all access paths in 'mod' that are visible from 'dc' if we
144160
/// subtract imports of 'other'.
145161
ArrayRef<ModuleDecl::AccessPathTy>
146162
getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
147163
const ModuleDecl *other,
148164
const DeclContext *dc);
149165

166+
/// Returns 'true' if a declaration named 'name' defined in 'other' shadows
167+
/// defined in 'mod', because no access paths can find 'name' in 'mod' from
168+
/// 'dc' if we ignore imports of 'other'.
169+
bool isShadowedBy(const ModuleDecl *mod,
170+
const ModuleDecl *other,
171+
DeclBaseName name,
172+
const DeclContext *dc) {
173+
auto accessPaths = getAllAccessPathsNotShadowedBy(mod, other, dc);
174+
return llvm::none_of(accessPaths,
175+
[&](ModuleDecl::AccessPathTy accessPath) {
176+
return ModuleDecl::matchesAccessPath(accessPath, name);
177+
});
178+
}
179+
180+
/// Qualified lookup into types uses a slightly different check that does not
181+
/// take access paths into account.
182+
bool isShadowedBy(const ModuleDecl *mod,
183+
const ModuleDecl *other,
184+
const DeclContext *dc) {
185+
auto accessPaths = getAllAccessPathsNotShadowedBy(mod, other, dc);
186+
return accessPaths.empty();
187+
}
188+
150189
/// This is a hack to cope with main file parsing and REPL parsing, where
151190
/// we can add ImportDecls after name binding.
152191
void clear() {

branches/tensorflow/include/swift/IDE/DigesterEnums.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ KEY_STRING(IntrotvOS, intro_tvOS)
152152
KEY_STRING(IntrowatchOS, intro_watchOS)
153153
KEY_STRING(Introswift, intro_swift)
154154
KEY_STRING(ObjCName, objc_name)
155-
KEY_STRING(InitKind, init_kind)
156155

157156
KEY_STRING_ARR(SuperclassNames, superclassNames)
158157
KEY_STRING_ARR(ToolArgs, tool_arguments)

branches/tensorflow/include/swift/SILOptimizer/Utils/StackNesting.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,10 @@ class StackNesting {
155155
return bitNumberForAlloc(AllocInst);
156156
}
157157

158-
/// Insert deallocations at block boundaries.
159-
Changes insertDeallocsAtBlockBoundaries();
160-
161158
/// Modifies the SIL to end up with a correct stack nesting.
162159
///
163160
/// Returns the status of what changes were made.
164-
bool adaptDeallocs();
161+
Changes adaptDeallocs();
165162
};
166163

167164
} // end namespace swift

branches/tensorflow/include/swift/Sema/IDETypeChecking.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ namespace swift {
4747
/// \returns true on convertible, false on not.
4848
bool isConvertibleTo(Type T1, Type T2, bool openArchetypes, DeclContext &DC);
4949

50+
bool isEqual(Type T1, Type T2, DeclContext &DC);
51+
52+
bool canPossiblyEqual(Type T1, Type T2, DeclContext &DC);
53+
5054
void collectDefaultImplementationForProtocolMembers(ProtocolDecl *PD,
5155
llvm::SmallDenseMap<ValueDecl*, ValueDecl*> &DefaultMap);
5256

branches/tensorflow/include/swift/Sema/IDETypeCheckingRequests.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class IsDeclApplicableRequest:
8787
// Type relation checking
8888
//----------------------------------------------------------------------------//
8989
enum class TypeRelation: uint8_t {
90+
EqualTo,
91+
PossiblyEqualTo,
9092
ConvertTo,
9193
};
9294

@@ -156,6 +158,8 @@ struct TypeRelationCheckInput {
156158
out << " is ";
157159
switch(owner.Relation) {
158160
#define CASE(NAME) case TypeRelation::NAME: out << #NAME << " "; break;
161+
CASE(EqualTo)
162+
CASE(PossiblyEqualTo)
159163
CASE(ConvertTo)
160164
#undef CASE
161165
}

0 commit comments

Comments
 (0)