Skip to content

Commit 9bcdee0

Browse files
authored
---
yaml --- r: 340461 b: refs/heads/rxwei-patch-1 c: 8677068 h: refs/heads/master i: 340459: 3157449
1 parent a85cf52 commit 9bcdee0

File tree

16 files changed

+115
-16
lines changed

16 files changed

+115
-16
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: 198e8d1a1f8d780346b22b57cad56c38ea68ed66
1018+
refs/heads/rxwei-patch-1: 8677068c5394de0b197b66b5c6f0a6cafb9c7260
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/include/swift/SIL/SILDebugScope.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ class SILDebugScope : public SILAllocated<SILDebugScope> {
6565
SILFunction *getParentFunction() const;
6666

6767
#ifndef NDEBUG
68-
void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69-
unsigned Indent = 0) const;
68+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69+
unsigned Indent = 0) const,
70+
"only for use in the debugger");
71+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SILModule &Mod) const, "only for use in the debugger");
7072
#endif
7173
};
7274

branches/rxwei-patch-1/lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ PlatformAvailability::PlatformAvailability(LangOptions &langOpts)
17461746
"APIs deprecated as of macOS 10.9 and earlier are unavailable in Swift";
17471747
break;
17481748

1749-
default:
1749+
case PlatformKind::none:
17501750
break;
17511751
}
17521752
}
@@ -1787,7 +1787,11 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
17871787
Optional<unsigned> minor = version.getMinor();
17881788

17891789
switch (platformKind) {
1790+
case PlatformKind::none:
1791+
llvm_unreachable("version but no platform?");
1792+
17901793
case PlatformKind::OSX:
1794+
case PlatformKind::OSXApplicationExtension:
17911795
// Anything deprecated in OSX 10.9.x and earlier is unavailable in Swift.
17921796
return major < 10 ||
17931797
(major == 10 && (!minor.hasValue() || minor.getValue() <= 9));
@@ -1803,10 +1807,9 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
18031807
case PlatformKind::watchOSApplicationExtension:
18041808
// No deprecation filter on watchOS
18051809
return false;
1806-
1807-
default:
1808-
return false;
18091810
}
1811+
1812+
llvm_unreachable("Unexpected platform");
18101813
}
18111814

18121815
ClangImporter::Implementation::Implementation(ASTContext &ctx,

branches/rxwei-patch-1/lib/Parse/ParseExpr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,8 +1963,9 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
19631963
unsigned QuoteLength;
19641964
tok QuoteKind;
19651965
std::tie(QuoteLength, QuoteKind) =
1966-
Tok.isMultilineString() ? std::make_tuple(3, tok::multiline_string_quote)
1967-
: std::make_tuple(1, tok::string_quote);
1966+
Tok.isMultilineString() ? std::make_tuple(3, tok::multiline_string_quote)
1967+
: std::make_tuple(1, Tok.getText().startswith("\'") ?
1968+
tok::single_quote: tok::string_quote);
19681969
unsigned CloseQuoteBegin = Tok.getLength() - DelimiterLength - QuoteLength;
19691970

19701971
OpenDelimiterStr = Tok.getRawText().take_front(DelimiterLength);

branches/rxwei-patch-1/lib/SIL/SILPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,6 +3005,12 @@ void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS,
30053005
}
30063006
OS << "}\n";
30073007
}
3008+
3009+
void SILDebugScope::dump(SILModule &Mod) const {
3010+
// We just use the default indent and llvm::errs().
3011+
dump(Mod.getASTContext().SourceMgr);
3012+
}
3013+
30083014
#endif
30093015

30103016
void SILSpecializeAttr::print(llvm::raw_ostream &OS) const {

branches/rxwei-patch-1/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,11 +1568,15 @@ collectDelegatingInitUses(const DIMemoryObjectInfo &TheMemory,
15681568
// be an end_borrow use in addition to the value_metatype.
15691569
if (isa<LoadBorrowInst>(User)) {
15701570
auto UserVal = cast<SingleValueInstruction>(User);
1571-
bool onlyUseIsValueMetatype = true;
1571+
bool onlyUseIsValueMetatype = false;
15721572
for (auto use : UserVal->getUses()) {
1573-
if (isa<EndBorrowInst>(use->getUser())
1574-
|| isa<ValueMetatypeInst>(use->getUser()))
1573+
auto *user = use->getUser();
1574+
if (isa<EndBorrowInst>(user))
15751575
continue;
1576+
if (isa<ValueMetatypeInst>(user)) {
1577+
onlyUseIsValueMetatype = true;
1578+
continue;
1579+
}
15761580
onlyUseIsValueMetatype = false;
15771581
break;
15781582
}

branches/rxwei-patch-1/lib/Sema/TypeCheckType.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,13 @@ Type TypeChecker::applyUnboundGenericArguments(
826826

827827
subs = parentType->getContextSubstitutions(decl->getDeclContext());
828828
skipRequirementsCheck |= parentType->hasTypeVariable();
829+
} else if (auto genericEnv =
830+
decl->getDeclContext()->getGenericEnvironmentOfContext()) {
831+
auto subMap = genericEnv->getForwardingSubstitutionMap();
832+
for (auto gp : subMap.getGenericSignature()->getGenericParams()) {
833+
subs[gp->getCanonicalType()->castTo<GenericTypeParamType>()] =
834+
Type(gp).subst(subMap);
835+
}
829836
}
830837

831838
SourceLoc noteLoc = decl->getLoc();

branches/rxwei-patch-1/test/ClangImporter/availability_ios.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -application-extension %s
23

34
// REQUIRES: OS=ios
45

branches/rxwei-patch-1/test/ClangImporter/availability_macosx.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -application-extension %s
23

34
// REQUIRES: OS=macosx
45

branches/rxwei-patch-1/test/SILOptimizer/definite_init_diagnostics.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,3 +1579,12 @@ class WeakCycle {
15791579
self.d = 10
15801580
}
15811581
}
1582+
1583+
// <rdar://51198592> DI was crashing as it wrongly detected a `type(of: self)`
1584+
// use in a delegating initializer, when there was none.
1585+
class DelegatingInitTest {
1586+
convenience init(x: Int) {
1587+
self // expected-warning {{expression of type 'DelegatingInitTest' is unused}}
1588+
// expected-error@-1 {{'self' used before 'self.init' call or assignment to 'self'}}
1589+
} // expected-error {{'self.init' isn't called on all paths before returning from initializer}}
1590+
}

branches/rxwei-patch-1/test/SILOptimizer/definite_init_markuninitialized_delegatingself.sil

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,20 @@ bb2:
275275
%7 = tuple ()
276276
return %7 : $()
277277
}
278+
279+
// <rdar://51198592> DI was crashing as it wrongly detected a `type(of: self)`
280+
// use in a delegating initializer, when there was none.
281+
class MyClass4 {
282+
}
283+
284+
sil hidden [ossa] @test_self_uninit_use_in_delegating_init : $@convention(method) (@thick MyClass4.Type) -> @owned MyClass4 {
285+
bb0(%1 : $@thick MyClass4.Type):
286+
%2 = alloc_stack $MyClass4, let, name "self"
287+
%3 = mark_uninitialized [delegatingself] %2 : $*MyClass4
288+
%5 = load_borrow %3 : $*MyClass4 // expected-error {{'self' used before 'self.init' call or assignment to 'self'}}
289+
end_borrow %5 : $MyClass4
290+
%7 = load [copy] %3 : $*MyClass4 // expected-error {{'self.init' isn't called on all paths before returning from initializer}}
291+
destroy_addr %3 : $*MyClass4
292+
dealloc_stack %2 : $*MyClass4
293+
return %7 : $MyClass4
294+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: rm -rf %t
2+
// RUN: %swift-syntax-test -input-source-filename %s -parse-gen > %t
3+
// RUN: diff -u %s %t
4+
5+
"abc"
6+
7+
RoundedRectangle(cornerRadius: 6.0)lengthlength'Integer' field' [binding value: \(int.value)]int'Double' field [binding value: \(double.value)]double

branches/rxwei-patch-1/utils/api_checker/sdk-module-lists/infer-imports.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import os
44
import sys
55

6-
blacklist = ["Kernel", "Ruby", "Tk"]
6+
blacklist = [
7+
"Kernel", "Ruby", "Tk",
8+
"DriverKit", "HIDDriverKit", "SkywalkDriverKit", # has C++ code
9+
"NetworkingDriverKit", "USBSerialDriverKit", # has C++ code
10+
]
711

812

913
def get_immediate_subdirectories(a_dir):
@@ -16,11 +20,19 @@ def get_frameworks(sdk_path):
1620
names = []
1721
for frame in os.listdir(frameworks_path):
1822
if frame.endswith(".framework"):
23+
name = frame[:-len(".framework")]
1924
header_dir_path = frameworks_path + '/' + frame + '/Headers'
2025
module_dir_path = frameworks_path + '/' + frame + '/Modules'
26+
swiftmodule_path = module_dir_path + '/' + name + '.swiftmodule'
2127
old_modulemap_path = frameworks_path + '/' + frame + '/module.map'
2228
old_modulemap_private_path = frameworks_path + '/' + frame + \
2329
'/module_private.map'
30+
31+
if os.path.exists(swiftmodule_path):
32+
if name not in blacklist:
33+
names.append(name)
34+
continue
35+
2436
if not os.path.exists(header_dir_path):
2537
if os.path.exists(module_dir_path):
2638
print >>sys.stderr, header_dir_path, \
@@ -36,7 +48,6 @@ def get_frameworks(sdk_path):
3648
if should_exclude_framework(frameworks_path + '/' + frame):
3749
continue
3850

39-
name = frame[:-len(".framework")]
4051
if name in blacklist:
4152
continue
4253
names.append(name)

branches/rxwei-patch-1/utils/gyb_syntax_support/Token.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ def macro_name(self):
249249

250250
Punctuator('StringQuote', 'string_quote', text='\\\"',
251251
classification='StringLiteral', serialization_code=102),
252+
Punctuator('SingleQuote', 'single_quote', text='\\\'',
253+
classification='StringLiteral', serialization_code=120),
252254
Punctuator('MultilineStringQuote', 'multiline_string_quote',
253255
text='\\\"\\\"\\\"', classification='StringLiteral',
254256
serialization_code=103),

branches/rxwei-patch-1/validation-test/StdlibUnittest/CrashingTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ TestSuiteCrashes.test("crashesUnexpectedly1") {
1919
print("crashesUnexpectedly1")
2020
fatalError("This should crash")
2121
}
22-
// CHECK: stdout>>> crashesUnexpectedly1
23-
// CHECK: stderr>>> Fatal error: This should crash:
22+
// CHECK-DAG: stdout>>> crashesUnexpectedly1
23+
// CHECK-DAG: stderr>>> Fatal error: This should crash:
2424
// CHECK: stderr>>> CRASHED: SIG
2525
// CHECK: [ FAIL ] TestSuiteCrashes.crashesUnexpectedly1
2626

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %target-swift-frontend %s -emit-ir
2+
3+
// SR-9954 / rdar://problem/48223824
4+
// Rejects well-formed that triggered a fallback diagnostic due to a bad
5+
// substitution.
6+
struct GenericThing <Param1, Param2> {
7+
init (closure: (String)->()) {
8+
9+
}
10+
}
11+
12+
struct ThingHolder <Param1> {
13+
func acceptThing <Param2> (thingGenerator: ()->GenericThing<Param1, Param2>) {
14+
15+
}
16+
}
17+
18+
struct A { }
19+
20+
func demo <Param1> (thingHolder: ThingHolder<Param1>) {
21+
typealias Thing <Param2> = GenericThing<Param1, Param2>
22+
thingHolder.acceptThing {
23+
Thing<A> { string in
24+
25+
}
26+
}
27+
}
28+

0 commit comments

Comments
 (0)