Skip to content

Commit dce0cbd

Browse files
committed
---
yaml --- r: 341372 b: refs/heads/rxwei-patch-1 c: e0031d0 h: refs/heads/master
1 parent e667e66 commit dce0cbd

21 files changed

+26
-170
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: 4a5c1a0a6cd1f006d8ca9f4fcf0a2c14e534dc9d
1018+
refs/heads/rxwei-patch-1: e0031d0b8f262a978f9f75e67cc14c00ed0cd928
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/AST/AnyFunctionRef.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,6 @@ class AnyFunctionRef {
7676
return !TheFunction.get<AbstractClosureExpr *>()->getType().isNull();
7777
}
7878

79-
bool hasSingleExpressionBody() const {
80-
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
81-
return AFD->hasSingleExpressionBody();
82-
return TheFunction.get<AbstractClosureExpr *>()->hasSingleExpressionBody();
83-
}
84-
85-
Expr *getSingleExpressionBody() const {
86-
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
87-
return AFD->getSingleExpressionBody();
88-
return TheFunction.get<AbstractClosureExpr *>()->getSingleExpressionBody();
89-
}
90-
9179
Type getType() const {
9280
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
9381
return AFD->getInterfaceType();

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3475,12 +3475,6 @@ class AbstractClosureExpr : public DeclContext, public Expr {
34753475
/// Whether this closure consists of a single expression.
34763476
bool hasSingleExpressionBody() const;
34773477

3478-
/// Retrieve the body for closure that has a single expression for
3479-
/// its body.
3480-
///
3481-
/// Only valid when \c hasSingleExpressionBody() is true.
3482-
Expr *getSingleExpressionBody() const;
3483-
34843478
static bool classof(const Expr *E) {
34853479
return E->getKind() >= ExprKind::First_AbstractClosureExpr &&
34863480
E->getKind() <= ExprKind::Last_AbstractClosureExpr;

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#ifndef SWIFT_AST_RESILIENCE_EXPANSION_H
1414
#define SWIFT_AST_RESILIENCE_EXPANSION_H
1515

16-
#include "llvm/Support/raw_ostream.h"
17-
1816
namespace swift {
1917

2018
/// A specification for how much to expand resilient types.
@@ -46,16 +44,6 @@ enum class ResilienceExpansion : unsigned {
4644
Last_ResilienceExpansion = Maximal
4745
};
4846

49-
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
50-
ResilienceExpansion expansion) {
51-
switch (expansion) {
52-
case ResilienceExpansion::Minimal:
53-
return os << "Minimal";
54-
case ResilienceExpansion::Maximal:
55-
return os << "Maximal";
56-
}
57-
}
58-
5947
} // namespace swift
6048

6149
#endif // LLVM_SWIFT_AST_CAPTURE_INFO_H

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ class SearchPathOptions {
6464
/// Path to search for compiler-relative header files.
6565
std::string RuntimeResourcePath;
6666

67-
/// Paths to search for compiler-relative stdlib dylibs, in order of
68-
/// preference.
69-
std::vector<std::string> RuntimeLibraryPaths;
67+
/// Path to search for compiler-relative stdlib dylibs.
68+
std::string RuntimeLibraryPath;
7069

7170
/// Paths to search for stdlib modules. One of these will be compiler-relative.
7271
std::vector<std::string> RuntimeLibraryImportPaths;

branches/rxwei-patch-1/include/swift/Basic/SourceManager.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,6 @@ class SourceManager {
103103
rangeContainsTokenLoc(Enclosing, Inner.End);
104104
}
105105

106-
/// Returns true if range \p R contains the code-completion location, if any.
107-
bool rangeContainsCodeCompletionLoc(SourceRange R) const {
108-
return CodeCompletionBufferID
109-
? rangeContainsTokenLoc(R, getCodeCompletionLoc())
110-
: false;
111-
}
112-
113106
/// Returns the buffer ID for the specified *valid* location.
114107
///
115108
/// Because a valid source location always corresponds to a source buffer,

branches/rxwei-patch-1/include/swift/SIL/TypeLowering.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,6 @@ class TypeLowering {
250250

251251
virtual ~TypeLowering() {}
252252

253-
/// Print out the internal state of this type lowering into \p os.
254-
void print(llvm::raw_ostream &os) const;
255-
256-
/// Dump out the internal state of this type lowering to llvm::dbgs().
257-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const, "Only for use in the debugger");
258-
259253
/// Are r-values of this type passed as arguments indirectly by formal
260254
/// convention?
261255
///

branches/rxwei-patch-1/lib/AST/Expr.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,15 +1918,6 @@ bool AbstractClosureExpr::hasSingleExpressionBody() const {
19181918
return true;
19191919
}
19201920

1921-
Expr *AbstractClosureExpr::getSingleExpressionBody() const {
1922-
if (auto closure = dyn_cast<ClosureExpr>(this))
1923-
return closure->getSingleExpressionBody();
1924-
else if (auto autoclosure = dyn_cast<AutoClosureExpr>(this))
1925-
return autoclosure->getSingleExpressionBody();
1926-
1927-
return nullptr;
1928-
}
1929-
19301921
#define FORWARD_SOURCE_LOCS_TO(CLASS, NODE) \
19311922
SourceRange CLASS::getSourceRange() const { \
19321923
return (NODE)->getSourceRange(); \

branches/rxwei-patch-1/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
using namespace swift;
3131
using namespace llvm::opt;
3232

33-
/// The path for Swift libraries in the OS on Darwin.
34-
#define DARWIN_OS_LIBRARY_PATH "/usr/lib/swift"
35-
3633
swift::CompilerInvocation::CompilerInvocation() {
3734
setTargetTriple(llvm::sys::getDefaultTargetTriple());
3835
}
@@ -69,10 +66,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
6966
llvm::SmallString<128> LibPath(SearchPathOpts.RuntimeResourcePath);
7067

7168
llvm::sys::path::append(LibPath, getPlatformNameForTriple(Triple));
72-
SearchPathOpts.RuntimeLibraryPaths.clear();
73-
SearchPathOpts.RuntimeLibraryPaths.push_back(LibPath.str());
74-
if (Triple.isOSDarwin())
75-
SearchPathOpts.RuntimeLibraryPaths.push_back(DARWIN_OS_LIBRARY_PATH);
69+
SearchPathOpts.RuntimeLibraryPath = LibPath.str();
7670

7771
// Set up the import paths containing the swiftmodules for the libraries in
7872
// RuntimeLibraryPath.

branches/rxwei-patch-1/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ class ParseableInterfaceModuleLoaderImpl {
10661066
}
10671067

10681068
bool isInResourceDir(StringRef path) {
1069-
StringRef resourceDir = ctx.SearchPathOpts.RuntimeResourcePath;
1069+
StringRef resourceDir = ctx.SearchPathOpts.RuntimeLibraryPath;
10701070
if (resourceDir.empty()) return false;
10711071
return path.startswith(resourceDir);
10721072
}

branches/rxwei-patch-1/lib/IRGen/GenType.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,23 +1227,7 @@ TypeConverter::TypeConverter(IRGenModule &IGM)
12271227
if (!doesPlatformUseLegacyLayouts(platformName, archName))
12281228
return;
12291229

1230-
// Find the first runtime library path that exists.
1231-
bool found = false;
1232-
for (auto &RuntimeLibraryPath
1233-
: IGM.Context.SearchPathOpts.RuntimeLibraryPaths) {
1234-
if (llvm::sys::fs::exists(RuntimeLibraryPath)) {
1235-
defaultPath.append(RuntimeLibraryPath);
1236-
found = true;
1237-
break;
1238-
}
1239-
}
1240-
if (!found) {
1241-
auto joined = llvm::join(IGM.Context.SearchPathOpts.RuntimeLibraryPaths,
1242-
"', '");
1243-
llvm::report_fatal_error("Unable to find a runtime library path at '"
1244-
+ joined + "'");
1245-
}
1246-
1230+
defaultPath.append(IGM.Context.SearchPathOpts.RuntimeLibraryPath);
12471231
llvm::sys::path::append(defaultPath, "layouts-");
12481232
defaultPath.append(archName);
12491233
defaultPath.append(".yaml");

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,15 @@ static void *loadRuntimeLib(StringRef runtimeLibPathWithName) {
5959
#endif
6060
}
6161

62-
static void *loadRuntimeLibAtPath(StringRef sharedLibName,
63-
StringRef runtimeLibPath) {
62+
static void *loadRuntimeLib(StringRef sharedLibName, StringRef runtimeLibPath) {
6463
// FIXME: Need error-checking.
6564
llvm::SmallString<128> Path = runtimeLibPath;
6665
llvm::sys::path::append(Path, sharedLibName);
6766
return loadRuntimeLib(Path);
6867
}
6968

70-
static void *loadRuntimeLib(StringRef sharedLibName,
71-
ArrayRef<std::string> runtimeLibPaths) {
72-
for (auto &runtimeLibPath : runtimeLibPaths) {
73-
if (void *handle = loadRuntimeLibAtPath(sharedLibName, runtimeLibPath))
74-
return handle;
75-
}
76-
return nullptr;
77-
}
78-
79-
void *swift::immediate::loadSwiftRuntime(ArrayRef<std::string>
80-
runtimeLibPaths) {
81-
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
69+
void *swift::immediate::loadSwiftRuntime(StringRef runtimeLibPath) {
70+
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, runtimeLibPath);
8271
}
8372

8473
static bool tryLoadLibrary(LinkLibrary linkLib,
@@ -116,9 +105,9 @@ static bool tryLoadLibrary(LinkLibrary linkLib,
116105
if (!success)
117106
success = loadRuntimeLib(stem);
118107

119-
// If that fails, try our runtime library paths.
108+
// If that fails, try our runtime library path.
120109
if (!success)
121-
success = loadRuntimeLib(stem, searchPathOpts.RuntimeLibraryPaths);
110+
success = loadRuntimeLib(stem, searchPathOpts.RuntimeLibraryPath);
122111
break;
123112
}
124113
case LibraryKind::Framework: {
@@ -251,7 +240,7 @@ int swift::RunImmediately(CompilerInstance &CI, const ProcessCmdLine &CmdLine,
251240
//
252241
// This must be done here, before any library loading has been done, to avoid
253242
// racing with the static initializers in user code.
254-
auto stdlib = loadSwiftRuntime(Context.SearchPathOpts.RuntimeLibraryPaths);
243+
auto stdlib = loadSwiftRuntime(Context.SearchPathOpts.RuntimeLibraryPath);
255244
if (!stdlib) {
256245
CI.getDiags().diagnose(SourceLoc(),
257246
diag::error_immediate_mode_missing_stdlib);

branches/rxwei-patch-1/lib/Immediate/ImmediateImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace immediate {
3737
/// Returns a handle to the runtime suitable for other \c dlsym or \c dlclose
3838
/// calls or \c null if an error occurred.
3939
///
40-
/// \param runtimeLibPaths Paths to search for stdlib dylibs.
41-
void *loadSwiftRuntime(ArrayRef<std::string> runtimeLibPaths);
40+
/// \param runtimeLibPath Path to search for compiler-relative stdlib dylibs.
41+
void *loadSwiftRuntime(StringRef runtimeLibPath);
4242
bool tryLoadLibraries(ArrayRef<LinkLibrary> LinkLibraries,
4343
SearchPathOptions SearchPathOpts,
4444
DiagnosticEngine &Diags);

branches/rxwei-patch-1/lib/Immediate/REPL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ class REPLEnvironment {
969969
ASTContext &Ctx = CI.getASTContext();
970970
Ctx.LangOpts.EnableAccessControl = false;
971971
if (!ParseStdlib) {
972-
if (!loadSwiftRuntime(Ctx.SearchPathOpts.RuntimeLibraryPaths)) {
972+
if (!loadSwiftRuntime(Ctx.SearchPathOpts.RuntimeLibraryPath)) {
973973
CI.getDiags().diagnose(SourceLoc(),
974974
diag::error_immediate_mode_missing_stdlib);
975975
return;

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,22 +2687,3 @@ unsigned TypeConverter::countNumberOfFields(SILType Ty,
26872687
TypeFields[key] = fieldsCount;
26882688
return std::max(fieldsCount, 1U);
26892689
}
2690-
2691-
void TypeLowering::print(llvm::raw_ostream &os) const {
2692-
auto BOOL = [&](bool b) -> StringRef {
2693-
if (b)
2694-
return "true";
2695-
return "false";
2696-
};
2697-
os << "Type Lowering for lowered type: " << LoweredType << ".\n"
2698-
<< "Expansion: " << ResilienceExpansion(ForExpansion) << "\n"
2699-
<< "isTrivial: " << BOOL(Properties.isTrivial()) << ".\n"
2700-
<< "isFixedABI: " << BOOL(Properties.isFixedABI()) << ".\n"
2701-
<< "isAddressOnly: " << BOOL(Properties.isAddressOnly()) << ".\n"
2702-
<< "isResilient: " << BOOL(Properties.isResilient()) << ".\n"
2703-
<< "\n";
2704-
}
2705-
2706-
void TypeLowering::dump() const {
2707-
print(llvm::dbgs());
2708-
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,6 @@ bool TypeChecker::typeCheckFunctionBuilderFuncBody(FuncDecl *FD,
496496
options |= TypeCheckExprFlags::ConvertTypeIsOpaqueReturnType;
497497
}
498498

499-
// If we are performing code-completion inside the functions body, supress
500-
// diagnostics to workaround typechecking performance problems.
501-
if (Context.SourceMgr.rangeContainsCodeCompletionLoc(
502-
FD->getBody()->getSourceRange()))
503-
options |= TypeCheckExprFlags::SuppressDiagnostics;
504-
505499
// Type-check the single result expression.
506500
Type returnExprType = typeCheckExpression(returnExpr, FD,
507501
TypeLoc::withoutLoc(returnType),
@@ -580,12 +574,6 @@ ConstraintSystem::TypeMatchResult ConstraintSystem::applyFunctionBuilder(
580574
assert(!builderType->hasTypeParameter());
581575
}
582576

583-
// If we are performing code-completion inside the closure body, supress
584-
// diagnostics to workaround typechecking performance problems.
585-
if (getASTContext().SourceMgr.rangeContainsCodeCompletionLoc(
586-
closure->getSourceRange()))
587-
Options |= ConstraintSystemFlags::SuppressDiagnostics;
588-
589577
BuilderClosureVisitor visitor(getASTContext(), this,
590578
/*wantExpr=*/true, builderType);
591579
Expr *singleExpr = visitor.visit(closure->getBody());

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -443,29 +443,6 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
443443
return RS;
444444
}
445445

446-
// If the body consisted of a single return without a result
447-
//
448-
// func foo() -> Int {
449-
// return
450-
// }
451-
//
452-
// in parseAbstractFunctionBody the return is given an empty, implicit tuple
453-
// as its result
454-
//
455-
// func foo() -> Int {
456-
// return ()
457-
// }
458-
//
459-
// Look for that case and diagnose it as missing return expression.
460-
if (!ResultTy->isVoid() && TheFunc->hasSingleExpressionBody()) {
461-
auto expr = TheFunc->getSingleExpressionBody();
462-
if (expr->isImplicit() && isa<TupleExpr>(expr) &&
463-
cast<TupleExpr>(expr)->getNumElements() == 0) {
464-
TC.diagnose(RS->getReturnLoc(), diag::return_expr_missing);
465-
return RS;
466-
}
467-
}
468-
469446
Expr *E = RS->getResult();
470447

471448
// In an initializer, the only expression allowed is "nil", which indicates

branches/rxwei-patch-1/test/Parse/omit_return_fail.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool {
44
value is type // expected-error {{use of undeclared type 'type'}}
55
}
6-
7-
func foo() -> Int {
8-
return // expected-error {{non-void function should return a value}}
9-
}

branches/rxwei-patch-1/test/stdlib/ObjCEvilClassInitialization.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ import StdlibUnittest
1414
let tests = TestSuite("ObjCEvilClassInitialization")
1515

1616
tests.test("GenericOnEvilClass") {
17-
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {
18-
struct Generic<T> {
19-
var type: T.Type { return T.self }
20-
}
21-
let g = Generic<EvilClass>()
22-
expectEqual("\(type(of: g))", "Generic<EvilClass>")
23-
expectEqual(g.type, EvilClass.self)
17+
struct Generic<T> {
18+
var type: T.Type { return T.self }
2419
}
20+
let g = Generic<EvilClass>()
21+
expectEqual("\(type(of: g))", "Generic<EvilClass>")
22+
expectEqual(g.type, EvilClass.self)
2523
}
2624

2725
runAllTests()

branches/rxwei-patch-1/test/stdlib/UIViewControllerAdditions.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RxUN: %target-build-swift -g %s -o %t/ViewControllerAdditions.out
2-
// RxUN: %target-run %t/ViewControllerAdditions.out %S/Inputs/UIViewControllerAdditions | %FileCheck %s
3-
// RUN: %target-run-simple-swift %S/Inputs/UIViewControllerAdditions | %FileCheck %s
2+
// RxUN: %target-run %t/ViewControllerAdditions.out %S/Inputs/UIViewControllerAdditions/* | %FileCheck %s
3+
// RUN: %target-run-simple-swift %S/Inputs/UIViewControllerAdditions/* | %FileCheck %s
44
// REQUIRES: executable_test
55

66
// REQUIRES: OS=ios
@@ -28,7 +28,9 @@ class View6Controller : UIViewController { }
2828
// no nib
2929
class MissingViewController : UIViewController { }
3030

31-
let bundle = Bundle(path: CommandLine.arguments[1])
31+
let nsarg1 = CommandLine.arguments[1] as NSString
32+
let bundlePath = nsarg1.deletingLastPathComponent
33+
let bundle = Bundle(path: bundlePath)
3234

3335
let v1 = View1Controller(nibName:nil, bundle:bundle)
3436
print("tag 1 0=\(v1.view.tag) you're it")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def macro_name(self):
314314
classification='StringLiteral', serialization_code=113),
315315

316316
Misc('Unknown', 'unknown', serialization_code=115),
317-
Misc('Identifier', 'identifier', classification='Identifier',
317+
Misc('Identifier', 'identifier', classification=None,
318318
serialization_code=105),
319319
Misc('UnspacedBinaryOperator', 'oper_binary_unspaced',
320320
serialization_code=107),

0 commit comments

Comments
 (0)