Skip to content

Commit b443aad

Browse files
committed
---
yaml --- r: 349118 b: refs/heads/master c: dd82b63 h: refs/heads/master
1 parent ad6e111 commit b443aad

File tree

28 files changed

+88
-477
lines changed

28 files changed

+88
-477
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: 443d6f7c300d0bfa1a215669e41bc5411f935c42
2+
refs/heads/master: dd82b63f6cc062b759b26dd714537b757e25e7cc
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/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,6 @@ option(SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING
377377
"Build stdlibCore with exclusivity checking enabled"
378378
FALSE)
379379

380-
option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
381-
"Enable experimental Swift differentiable programming features"
382-
FALSE)
383-
384380
#
385381
# End of user-configurable options.
386382
#

trunk/benchmark/single-source/UTF8Decode.swift

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ public let UTF8Decode = [
4242
name: "UTF8Decode_InitFromBytes_ascii",
4343
runFunction: run_UTF8Decode_InitFromBytes_ascii,
4444
tags: [.validation, .api, .String]),
45-
BenchmarkInfo(
46-
name: "UTF8Decode_InitFromData_ascii_as_ascii",
47-
runFunction: run_UTF8Decode_InitFromData_ascii_as_ascii,
48-
tags: [.validation, .api, .String]),
49-
BenchmarkInfo(
50-
name: "UTF8Decode_InitDecoding_ascii_as_ascii",
51-
runFunction: run_UTF8Decode_InitDecoding_ascii_as_ascii,
52-
tags: [.validation, .api, .String]),
53-
BenchmarkInfo(
54-
name: "UTF8Decode_InitFromBytes_ascii_as_ascii",
55-
runFunction: run_UTF8Decode_InitFromBytes_ascii_as_ascii,
56-
tags: [.validation, .api, .String]),
5745
]
5846

5947
// 1-byte sequences
@@ -141,26 +129,4 @@ public func run_UTF8Decode_InitFromBytes_ascii(_ N: Int) {
141129
}
142130
}
143131

144-
@inline(never)
145-
public func run_UTF8Decode_InitFromData_ascii_as_ascii(_ N: Int) {
146-
let input = asciiData
147-
for _ in 0..<1_000*N {
148-
blackHole(String(data: input, encoding: .ascii))
149-
}
150-
}
151-
@inline(never)
152-
public func run_UTF8Decode_InitDecoding_ascii_as_ascii(_ N: Int) {
153-
let input = asciiBytes
154-
for _ in 0..<1_000*N {
155-
blackHole(String(decoding: input, as: Unicode.ASCII.self))
156-
}
157-
}
158-
@inline(never)
159-
public func run_UTF8Decode_InitFromBytes_ascii_as_ascii(_ N: Int) {
160-
let input = asciiBytes
161-
for _ in 0..<1_000*N {
162-
blackHole(String(bytes: input, encoding: .ascii))
163-
}
164-
}
165-
166132

trunk/cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ function(_add_variant_swift_compile_flags
422422
list(APPEND result "-D" "SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS")
423423
endif()
424424

425-
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
426-
list(APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING")
427-
endif()
428-
429425
set("${result_var_name}" "${result}" PARENT_SCOPE)
430426
endfunction()
431427

trunk/include/swift/AST/Decl.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4786,8 +4786,6 @@ class VarDecl : public AbstractStorageDecl {
47864786
bool issCaptureList, SourceLoc nameLoc, Identifier name,
47874787
DeclContext *dc, StorageIsMutable_t supportsMutation);
47884788

4789-
TypeRepr *ParentRepr = nullptr;
4790-
47914789
Type typeInContext;
47924790

47934791
public:
@@ -4806,11 +4804,6 @@ class VarDecl : public AbstractStorageDecl {
48064804
return hasName() ? getBaseName().getIdentifier().str() : "_";
48074805
}
48084806

4809-
/// Retrieve the TypeRepr corresponding to the parsed type of the parent
4810-
/// pattern, if it exists.
4811-
TypeRepr *getTypeRepr() const { return ParentRepr; }
4812-
void setTypeRepr(TypeRepr *repr) { ParentRepr = repr; }
4813-
48144807
bool hasType() const {
48154808
// We have a type if either the type has been computed already or if
48164809
// this is a deserialized declaration with an interface type.
@@ -4864,6 +4857,14 @@ class VarDecl : public AbstractStorageDecl {
48644857
///
48654858
Pattern *getParentPattern() const;
48664859

4860+
/// Returns the parsed type of this variable declaration. For parameters, this
4861+
/// is the parsed type the user explicitly wrote. For variables, this is the
4862+
/// type the user wrote in the typed pattern that binds this variable.
4863+
///
4864+
/// Note that there are many cases where the user may elide types. This will
4865+
/// return null in those cases.
4866+
TypeRepr *getTypeReprOrParentPatternTypeRepr() const;
4867+
48674868
/// Return the statement that owns the pattern associated with this VarDecl,
48684869
/// if one exists.
48694870
///
@@ -5158,6 +5159,8 @@ class ParamDecl : public VarDecl {
51585159
SourceLoc ArgumentNameLoc;
51595160
SourceLoc SpecifierLoc;
51605161

5162+
TypeRepr *TyRepr = nullptr;
5163+
51615164
struct StoredDefaultArgument {
51625165
PointerUnion<Expr *, VarDecl *> DefaultArg;
51635166
Initializer *InitContext = nullptr;
@@ -5203,6 +5206,10 @@ class ParamDecl : public VarDecl {
52035206

52045207
SourceLoc getSpecifierLoc() const { return SpecifierLoc; }
52055208

5209+
/// Retrieve the TypeRepr corresponding to the parsed type of the parameter, if it exists.
5210+
TypeRepr *getTypeRepr() const { return TyRepr; }
5211+
void setTypeRepr(TypeRepr *repr) { TyRepr = repr; }
5212+
52065213
DefaultArgumentKind getDefaultArgumentKind() const {
52075214
return static_cast<DefaultArgumentKind>(Bits.ParamDecl.defaultArgumentKind);
52085215
}

trunk/include/swift/SIL/SILConstants.h

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct DerivedAddressValue;
3333
struct EnumWithPayloadSymbolicValue;
3434
struct SymbolicValueMemoryObject;
3535
struct UnknownSymbolicValue;
36-
struct SymbolicClosure;
3736

3837
extern llvm::cl::opt<unsigned> ConstExprLimit;
3938

@@ -262,9 +261,6 @@ class SymbolicValue {
262261

263262
/// This represents an array.
264263
RK_Array,
265-
266-
/// This represents a closure.
267-
RK_Closure,
268264
};
269265

270266
union {
@@ -309,7 +305,7 @@ class SymbolicValue {
309305
/// information about the memory object and access path of the access.
310306
DerivedAddressValue *derivedAddress;
311307

312-
// The following two fields are for representing an Array.
308+
// The following fields are for representing an Array.
313309
//
314310
// In Swift, an array is a non-trivial struct that stores a reference to an
315311
// internal storage: _ContiguousArrayStorage. Though arrays have value
@@ -333,10 +329,6 @@ class SymbolicValue {
333329
/// When this symbolic value is of an "Array" kind, this stores a memory
334330
/// object that contains a SymbolicArrayStorage value.
335331
SymbolicValueMemoryObject *array;
336-
337-
/// When this symbolic value is of "Closure" kind, store a pointer to the
338-
/// symbolic representation of the closure.
339-
SymbolicClosure *closure;
340332
} value;
341333

342334
RepresentationKind representationKind : 8;
@@ -392,9 +384,6 @@ class SymbolicValue {
392384
/// This represents an array value.
393385
Array,
394386

395-
/// This represents a closure.
396-
Closure,
397-
398387
/// These values are generally only seen internally to the system, external
399388
/// clients shouldn't have to deal with them.
400389
UninitMemory
@@ -544,22 +533,6 @@ class SymbolicValue {
544533
/// Return the type of this array symbolic value.
545534
Type getArrayType() const;
546535

547-
/// Create and return a symbolic value that represents a closure.
548-
/// \param target SILFunction corresponding the target of the closure.
549-
/// \param capturedArguments an array consisting of SILValues of captured
550-
/// arguments along with their symbolic values when available.
551-
/// \param allocator the allocator to use for storing the contents of this
552-
/// symbolic value.
553-
static SymbolicValue makeClosure(
554-
SILFunction *target,
555-
ArrayRef<std::pair<SILValue, Optional<SymbolicValue>>> capturedArguments,
556-
SymbolicValueAllocator &allocator);
557-
558-
SymbolicClosure *getClosure() const {
559-
assert(getKind() == Closure);
560-
return value.closure;
561-
}
562-
563536
//===--------------------------------------------------------------------===//
564537
// Helpers
565538

@@ -634,57 +607,6 @@ struct SymbolicValueMemoryObject {
634607
SymbolicValueMemoryObject(const SymbolicValueMemoryObject &) = delete;
635608
void operator=(const SymbolicValueMemoryObject &) = delete;
636609
};
637-
638-
using SymbolicClosureArgument = std::pair<SILValue, Optional<SymbolicValue>>;
639-
640-
/// Representation of a symbolic closure. A symbolic closure consists of a
641-
/// SILFunction and an array of SIL values, corresponding to the captured
642-
/// arguments, and (optional) symbolic values representing the constant values
643-
/// of the captured arguments. The symbolic values are optional as it is not
644-
/// necessary for every captured argument to be a constant, which enables
645-
/// representing closures whose captured arguments are not compile-time
646-
/// constants.
647-
struct SymbolicClosure final
648-
: private llvm::TrailingObjects<SymbolicClosure, SymbolicClosureArgument> {
649-
650-
friend class llvm::TrailingObjects<SymbolicClosure, SymbolicClosureArgument>;
651-
652-
private:
653-
654-
SILFunction *target;
655-
656-
// The number of SIL values captured by the closure.
657-
unsigned numCaptures;
658-
659-
// True iff there exists captured arguments whose constant value is not known.
660-
bool hasNonConstantCaptures = true;
661-
662-
SymbolicClosure() = delete;
663-
SymbolicClosure(const SymbolicClosure &) = delete;
664-
SymbolicClosure(SILFunction *callee, unsigned numArguments,
665-
bool nonConstantCaptures)
666-
: target(callee), numCaptures(numArguments),
667-
hasNonConstantCaptures(nonConstantCaptures) {}
668-
669-
public:
670-
static SymbolicClosure *create(SILFunction *callee,
671-
ArrayRef<SymbolicClosureArgument> args,
672-
SymbolicValueAllocator &allocator);
673-
674-
ArrayRef<SymbolicClosureArgument> getCaptures() const {
675-
return {getTrailingObjects<SymbolicClosureArgument>(), numCaptures};
676-
}
677-
678-
// This is used by the llvm::TrailingObjects base class.
679-
size_t numTrailingObjects(OverloadToken<SymbolicClosureArgument>) const {
680-
return numCaptures;
681-
}
682-
683-
SILFunction *getTarget() {
684-
return target;
685-
}
686-
};
687-
688610
} // end namespace swift
689611

690612
#endif

trunk/lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2524,7 +2524,7 @@ void PrintAST::visitVarDecl(VarDecl *decl) {
25242524
if (decl->hasInterfaceType()) {
25252525
Printer << ": ";
25262526
TypeLoc tyLoc;
2527-
if (auto *repr = decl->getTypeRepr())
2527+
if (auto *repr = decl->getTypeReprOrParentPatternTypeRepr())
25282528
tyLoc = TypeLoc(repr, decl->getInterfaceType());
25292529
else
25302530
tyLoc = TypeLoc::withoutLoc(decl->getInterfaceType());

trunk/lib/AST/Decl.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,7 +2595,7 @@ OpaqueReturnTypeRepr *ValueDecl::getOpaqueResultTypeRepr() const {
25952595
}
25962596
}
25972597
} else {
2598-
returnRepr = VD->getTypeRepr();
2598+
returnRepr = VD->getTypeReprOrParentPatternTypeRepr();
25992599
}
26002600
} else if (auto *FD = dyn_cast<FuncDecl>(this)) {
26012601
returnRepr = FD->getBodyResultTypeLoc().getTypeRepr();
@@ -5285,6 +5285,16 @@ Pattern *VarDecl::getParentPattern() const {
52855285
return nullptr;
52865286
}
52875287

5288+
TypeRepr *VarDecl::getTypeReprOrParentPatternTypeRepr() const {
5289+
if (auto *param = dyn_cast<ParamDecl>(this))
5290+
return param->getTypeRepr();
5291+
5292+
if (auto *parentPattern = dyn_cast_or_null<TypedPattern>(getParentPattern()))
5293+
return parentPattern->getTypeLoc().getTypeRepr();
5294+
5295+
return nullptr;
5296+
}
5297+
52885298
NullablePtr<VarDecl>
52895299
VarDecl::getCorrespondingFirstCaseLabelItemVarDecl() const {
52905300
if (!hasName())
@@ -5643,16 +5653,11 @@ void VarDecl::emitLetToVarNoteIfSimple(DeclContext *UseDC) const {
56435653
if (AD->isGetter() && !AD->getAccessorKeywordLoc().isValid())
56445654
return;
56455655
}
5646-
5656+
56475657
auto &d = getASTContext().Diags;
5648-
auto diags = d.diagnose(FD->getFuncLoc(), diag::change_to_mutating,
5649-
isa<AccessorDecl>(FD));
5650-
if (auto nonmutatingAttr =
5651-
FD->getAttrs().getAttribute<NonMutatingAttr>()) {
5652-
diags.fixItReplace(nonmutatingAttr->getLocation(), "mutating");
5653-
} else {
5654-
diags.fixItInsert(FD->getFuncLoc(), "mutating ");
5655-
}
5658+
d.diagnose(FD->getFuncLoc(), diag::change_to_mutating,
5659+
isa<AccessorDecl>(FD))
5660+
.fixItInsert(FD->getFuncLoc(), "mutating ");
56565661
return;
56575662
}
56585663
}

trunk/lib/IRGen/GenEnum.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,12 +1127,10 @@ namespace {
11271127
protected:
11281128
int64_t getDiscriminatorIndex(EnumElementDecl *target) const override {
11291129
// The elements are assigned discriminators ABI-compatible with their
1130-
// raw values from C. An invalid raw value is assigned the error index -1.
1131-
auto intExpr =
1132-
dyn_cast_or_null<IntegerLiteralExpr>(target->getRawValueExpr());
1133-
if (!intExpr) {
1134-
return -1;
1135-
}
1130+
// raw values from C.
1131+
assert(target->getRawValueExpr()
1132+
&& "c-compatible enum elt has no raw value?!");
1133+
auto intExpr = cast<IntegerLiteralExpr>(target->getRawValueExpr());
11361134
auto intType = getDiscriminatorType();
11371135

11381136
APInt intValue =

0 commit comments

Comments
 (0)