Skip to content

Commit ca117a4

Browse files
committed
---
yaml --- r: 341374 b: refs/heads/rxwei-patch-1 c: ce3aff1 h: refs/heads/master
1 parent 4bc90cd commit ca117a4

26 files changed

+54
-215
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: 5cf7ce7ab4c22069bb63179ee349a05cb4e4caad
1018+
refs/heads/rxwei-patch-1: ce3aff12da2821314b6555c6ff98de4abeaa5cdc
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/ByteTreeSerialization.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class ByteTreeWriter {
155155
llvm::BinaryStreamWriter &StreamWriter;
156156

157157
/// The underlying stream of the StreamWriter. We need this reference so that
158-
/// we can call \c ExponentialGrowthAppendingBinaryByteStream.writeRaw
158+
/// we can call \c ExponentialGrowthAppendingBinaryByteStream.writeInteger
159159
/// which is more efficient than the generic \c writeBytes of
160160
/// \c llvm::BinaryStreamWriter since it avoids the arbitrary size memcopy.
161161
ExponentialGrowthAppendingBinaryByteStream &Stream;
@@ -179,13 +179,10 @@ class ByteTreeWriter {
179179
llvm::BinaryStreamWriter &StreamWriter, UserInfoMap &UserInfo)
180180
: StreamWriter(StreamWriter), Stream(Stream), UserInfo(UserInfo) {}
181181

182-
/// Write the given value to the ByteTree in the same form in which it is
183-
/// represented on the serializing machine.
182+
/// Write the given value to the ByteTree in little-endian byte order.
184183
template <typename T>
185-
llvm::Error writeRaw(T Value) {
186-
// FIXME: We implicitly inherit the endianess of the serializing machine.
187-
// Since we're currently only supporting macOS that's not a problem for now.
188-
auto Error = Stream.writeRaw(StreamWriter.getOffset(), Value);
184+
llvm::Error writeInteger(T Value) {
185+
auto Error = Stream.writeInteger(StreamWriter.getOffset(), Value);
189186
StreamWriter.setOffset(StreamWriter.getOffset() + sizeof(T));
190187
return Error;
191188
}
@@ -205,7 +202,7 @@ class ByteTreeWriter {
205202
// Set the most significant bit to indicate that the next construct is an
206203
// object and not a scalar.
207204
uint32_t ToWrite = NumFields | (1 << 31);
208-
auto Error = writeRaw(ToWrite);
205+
auto Error = writeInteger(ToWrite);
209206
(void)Error;
210207
assert(!Error);
211208

@@ -241,7 +238,7 @@ class ByteTreeWriter {
241238
llvm::BinaryStreamWriter StreamWriter(Stream);
242239
ByteTreeWriter Writer(Stream, StreamWriter, UserInfo);
243240

244-
auto Error = Writer.writeRaw(ProtocolVersion);
241+
auto Error = Writer.writeInteger(ProtocolVersion);
245242
(void)Error;
246243
assert(!Error);
247244

@@ -272,7 +269,7 @@ class ByteTreeWriter {
272269
// bitflag that indicates if the next construct in the tree is an object
273270
// or a scalar.
274271
assert((ValueSize & ((uint32_t)1 << 31)) == 0 && "Value size too large");
275-
auto SizeError = writeRaw(ValueSize);
272+
auto SizeError = writeInteger(ValueSize);
276273
(void)SizeError;
277274
assert(!SizeError);
278275

@@ -292,11 +289,11 @@ class ByteTreeWriter {
292289
validateAndIncreaseFieldIndex(Index);
293290

294291
uint32_t ValueSize = sizeof(T);
295-
auto SizeError = writeRaw(ValueSize);
292+
auto SizeError = writeInteger(ValueSize);
296293
(void)SizeError;
297294
assert(!SizeError);
298295

299-
auto ContentError = writeRaw(Value);
296+
auto ContentError = writeInteger(Value);
300297
(void)ContentError;
301298
assert(!ContentError);
302299
}

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

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,10 @@ class ExponentialGrowthAppendingBinaryByteStream
3333
/// The buffer holding the data.
3434
SmallVector<uint8_t, 0> Data;
3535

36-
llvm::support::endianness Endian;
36+
/// Data in the stream is always encoded in little-endian byte order.
37+
const llvm::support::endianness Endian = llvm::support::endianness::little;
3738
public:
38-
ExponentialGrowthAppendingBinaryByteStream()
39-
: ExponentialGrowthAppendingBinaryByteStream(
40-
llvm::support::endianness::little) {}
41-
ExponentialGrowthAppendingBinaryByteStream(llvm::support::endianness Endian)
42-
: Endian(Endian) {}
39+
ExponentialGrowthAppendingBinaryByteStream() = default;
4340

4441
void reserve(size_t Size);
4542

@@ -57,16 +54,11 @@ class ExponentialGrowthAppendingBinaryByteStream
5754

5855
llvm::Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) override;
5956

60-
/// This is an optimized version of \c writeBytes that assumes we know the
61-
/// size of \p Value at compile time (which in particular holds for integers).
62-
/// It does so by exposing the memcpy to the optimizer along with the size
63-
/// of the value being assigned; the compiler can then optimize the memcpy
64-
/// into a fixed set of instructions.
65-
/// This assumes that the endianess of this steam is the same as the native
66-
/// endianess on the executing machine. No endianess transformations are
67-
/// performed.
57+
/// This is an optimized version of \c writeBytes specifically for integers.
58+
/// Integers are written in little-endian byte order.
6859
template<typename T>
69-
llvm::Error writeRaw(uint32_t Offset, T Value) {
60+
llvm::Error writeInteger(uint32_t Offset, T Value) {
61+
static_assert(std::is_integral<T>::value, "Integer required.");
7062
if (auto Error = checkOffsetForWrite(Offset, sizeof(T))) {
7163
return Error;
7264
}
@@ -77,7 +69,8 @@ class ExponentialGrowthAppendingBinaryByteStream
7769
Data.resize(RequiredSize);
7870
}
7971

80-
::memcpy(Data.data() + Offset, &Value, sizeof Value);
72+
llvm::support::endian::write<T, llvm::support::unaligned>(
73+
Data.data() + Offset, Value, Endian);
8174

8275
return llvm::Error::success();
8376
}

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-
}

0 commit comments

Comments
 (0)