Skip to content

Commit abad4b8

Browse files
authored
---
yaml --- r: 327663 b: refs/heads/tensorflow c: c5ae17d h: refs/heads/master i: 327661: 6bb0b4c 327659: 07635b5 327655: a9e36e7 327647: 597a54a
1 parent c7768c2 commit abad4b8

Some content is hidden

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

54 files changed

+633
-321
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: 5285afdbe6697fb4d3a9c9b029a4e1be5a6b3941
819+
refs/heads/tensorflow: c5ae17d5445495622cd4995ecff419b672cca9b8
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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
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)|
2017
|**[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)|
2118
|**[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)|
2219
|**[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: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
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+
518
## Enums
619

720
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.
@@ -114,15 +127,7 @@ In C, enumerators (enum cases) aren't namespaced under their enum type, so their
114127

115128
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.
116129

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").
130+
2. Find the common word-boundary prefix __CP__ of these cases.
126131

127132
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.
128133

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

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

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

149154
## `swift_wrapper` typedefs
150155

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

191196
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.
192197

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+
193242
## More to come...

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@ DECL_ATTR(available, Available,
121121
1)
122122
CONTEXTUAL_SIMPLE_DECL_ATTR(final, Final,
123123
OnClass | OnFunc | OnAccessor | OnVar | OnSubscript |
124-
DeclModifier,
124+
DeclModifier | ABIBreakingToAdd | ABIBreakingToRemove |
125+
APIBreakingToAdd,
125126
2)
126127
DECL_ATTR(objc, ObjC,
127128
OnAbstractFunction | OnClass | OnProtocol | OnExtension | OnVar |
128-
OnSubscript | OnEnum | OnEnumElement,
129+
OnSubscript | OnEnum | OnEnumElement | ABIBreakingToAdd | ABIBreakingToRemove,
129130
3)
130131
CONTEXTUAL_SIMPLE_DECL_ATTR(required, Required,
131132
OnConstructor |
@@ -187,7 +188,7 @@ DECL_ATTR(_semantics, Semantics,
187188
21)
188189
CONTEXTUAL_SIMPLE_DECL_ATTR(dynamic, Dynamic,
189190
OnFunc | OnAccessor | OnVar | OnSubscript | OnConstructor |
190-
DeclModifier,
191+
DeclModifier | ABIBreakingToAdd | ABIBreakingToRemove,
191192
22)
192193
CONTEXTUAL_SIMPLE_DECL_ATTR(infix, Infix,
193194
OnFunc | OnOperator |
@@ -212,7 +213,7 @@ SIMPLE_DECL_ATTR(nonobjc, NonObjC,
212213
30)
213214
SIMPLE_DECL_ATTR(_fixed_layout, FixedLayout,
214215
OnVar | OnClass | OnStruct |
215-
UserInaccessible,
216+
UserInaccessible | ABIBreakingToAdd | ABIBreakingToRemove,
216217
31)
217218
SIMPLE_DECL_ATTR(inlinable, Inlinable,
218219
OnVar | OnSubscript | OnAbstractFunction,
@@ -362,7 +363,7 @@ SIMPLE_DECL_ATTR(_weakLinked, WeakLinked,
362363
OnSubscript | OnConstructor | OnEnumElement | OnExtension | UserInaccessible,
363364
75)
364365
SIMPLE_DECL_ATTR(frozen, Frozen,
365-
OnEnum | OnStruct,
366+
OnEnum | OnStruct | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToRemove,
366367
76)
367368
DECL_ATTR_ALIAS(_frozen, Frozen)
368369
SIMPLE_DECL_ATTR(_forbidSerializingReference, ForbidSerializingReference,

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@ 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),
356368
};
357369

358370
LLVM_READNONE
@@ -435,6 +447,21 @@ class DeclAttribute : public AttributeBase {
435447
return getOptions(DK) & UserInaccessible;
436448
}
437449

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+
438465
bool isDeclModifier() const {
439466
return isDeclModifier(getKind());
440467
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ 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+
101103
#ifndef DIAG_NO_UNDEF
102104
# if defined(DIAG)
103105
# undef DIAG

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

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -140,52 +140,13 @@ 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-
159143
/// Returns all access paths in 'mod' that are visible from 'dc' if we
160144
/// subtract imports of 'other'.
161145
ArrayRef<ModuleDecl::AccessPathTy>
162146
getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
163147
const ModuleDecl *other,
164148
const DeclContext *dc);
165149

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-
189150
/// This is a hack to cope with main file parsing and REPL parsing, where
190151
/// we can add ImportDecls after name binding.
191152
void clear() {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ 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)
155156

156157
KEY_STRING_ARR(SuperclassNames, superclassNames)
157158
KEY_STRING_ARR(ToolArgs, tool_arguments)

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

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

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

164167
} // end namespace swift

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ 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-
5450
void collectDefaultImplementationForProtocolMembers(ProtocolDecl *PD,
5551
llvm::SmallDenseMap<ValueDecl*, ValueDecl*> &DefaultMap);
5652

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

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

@@ -158,8 +156,6 @@ struct TypeRelationCheckInput {
158156
out << " is ";
159157
switch(owner.Relation) {
160158
#define CASE(NAME) case TypeRelation::NAME: out << #NAME << " "; break;
161-
CASE(EqualTo)
162-
CASE(PossiblyEqualTo)
163159
CASE(ConvertTo)
164160
#undef CASE
165161
}

0 commit comments

Comments
 (0)