Skip to content

Commit 9a3aee7

Browse files
committed
---
yaml --- r: 341722 b: refs/heads/rxwei-patch-1 c: f27ccab h: refs/heads/master
1 parent 0eee893 commit 9a3aee7

File tree

152 files changed

+1274
-1909
lines changed

Some content is hidden

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

152 files changed

+1274
-1909
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: 37db5872c36fa1c5428b1f692b33a6ad1cbe865c
1018+
refs/heads/rxwei-patch-1: f27ccabdb156fd808cfb774f6e9243b32146109f
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/docs/ABI/Mangling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ conformance within the witness table, identified by the dependent type and
717717
protocol. In all cases, the DEPENDENT-CONFORMANCE-INDEX is an INDEX value
718718
indicating the position of the appropriate value within the generic environment
719719
(for "HD") or witness table (for "HI" and "HA") when it is known to be at a
720-
fixed position. An index of 1 ("0\_") is used to indicate "unknown"; all other
720+
fixed position. An index of 1 ("0_") is used to indicate "unknown"; all other
721721
values are adjusted by 2. That these indexes are not 0-based is a bug that's
722722
now codified into the ABI; the index 0 is therefore reserved.
723723

branches/rxwei-patch-1/docs/SIL.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5110,15 +5110,13 @@ cond_fail
51105110
`````````
51115111
::
51125112

5113-
sil-instruction ::= 'cond_fail' sil-operand, string-literal
5113+
sil-instruction ::= 'cond_fail' sil-operand
51145114

5115-
cond_fail %0 : $Builtin.Int1, "failure reason"
5115+
cond_fail %0 : $Builtin.Int1
51165116
// %0 must be of type $Builtin.Int1
51175117

51185118
This instruction produces a `runtime failure`_ if the operand is one.
51195119
Execution proceeds normally if the operand is zero.
5120-
The second operand is a static failure message, which is displayed by the
5121-
debugger in case the failure is triggered.
51225120

51235121
Terminators
51245122
~~~~~~~~~~~

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#ifndef SWIFT_AST_ANYREQUEST_H
1818
#define SWIFT_AST_ANYREQUEST_H
1919

20-
#include "swift/Basic/SourceLoc.h"
2120
#include "swift/Basic/TypeID.h"
2221
#include "llvm/ADT/DenseMapInfo.h"
2322
#include "llvm/ADT/Hashing.h"
@@ -86,9 +85,6 @@ class AnyRequest {
8685

8786
/// Note that this request is part of a cycle.
8887
virtual void noteCycleStep(DiagnosticEngine &diags) const = 0;
89-
90-
/// Retrieve the nearest source location to which this request applies.
91-
virtual SourceLoc getNearestLoc() const = 0;
9288
};
9389

9490
/// Holds a value that can be used as a request input/output.
@@ -129,11 +125,6 @@ class AnyRequest {
129125
virtual void noteCycleStep(DiagnosticEngine &diags) const override {
130126
request.noteCycleStep(diags);
131127
}
132-
133-
/// Retrieve the nearest source location to which this request applies.
134-
virtual SourceLoc getNearestLoc() const override {
135-
return request.getNearestLoc();
136-
}
137128
};
138129

139130
/// FIXME: Inefficient. Use the low bits.
@@ -211,11 +202,6 @@ class AnyRequest {
211202
stored->noteCycleStep(diags);
212203
}
213204

214-
/// Retrieve the nearest source location to which this request applies.
215-
SourceLoc getNearestLoc() const {
216-
return stored->getNearestLoc();
217-
}
218-
219205
/// Compare two instances for equality.
220206
friend bool operator==(const AnyRequest &lhs, const AnyRequest &rhs) {
221207
if (lhs.storageKind != rhs.storageKind) {

branches/rxwei-patch-1/include/swift/AST/Builtins.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ BUILTIN_SIL_OPERATION(BeginUnpairedModifyAccess, "beginUnpairedModifyAccess",
314314
/// be a pointer to an UnsafeValueBuffer that records an in progress access.
315315
BUILTIN_SIL_OPERATION(EndUnpairedAccess, "endUnpairedAccess", Special)
316316

317+
/// condfail(Int1) -> ()
318+
/// Triggers a runtime failure if the condition is true.
319+
BUILTIN_SIL_OPERATION(CondFail, "condfail", Special)
320+
317321
/// fixLifetime(T) -> ()
318322
/// Fixes the lifetime of any heap references in a value.
319323
BUILTIN_SIL_OPERATION(FixLifetime, "fixLifetime", Special)
@@ -400,10 +404,6 @@ BUILTIN_RUNTIME_CALL(IsOptionalType, "isOptional", "")
400404
BUILTIN(Id, Name, Attrs)
401405
#endif
402406

403-
/// condfail(Int1, RawPointer) -> ()
404-
/// Triggers a runtime failure if the condition is true.
405-
BUILTIN_MISC_OPERATION(CondFail, "condfail", "", Special)
406-
407407
/// Sizeof has type T.Type -> Int
408408
BUILTIN_MISC_OPERATION(Sizeof, "sizeof", "n", Special)
409409

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5615,7 +5615,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56155615
}
56165616

56175617
struct BodySynthesizer {
5618-
std::pair<BraceStmt *, bool> (* Fn)(AbstractFunctionDecl *, void *);
5618+
void (* Fn)(AbstractFunctionDecl *, void *);
56195619
void *Context;
56205620
};
56215621

@@ -5748,8 +5748,18 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
57485748
/// have a body for this function.
57495749
///
57505750
/// \sa hasBody()
5751-
BraceStmt *getBody(bool canSynthesize = true) const;
5752-
5751+
BraceStmt *getBody(bool canSynthesize = true) const {
5752+
if (canSynthesize && getBodyKind() == BodyKind::Synthesize) {
5753+
const_cast<AbstractFunctionDecl *>(this)->setBodyKind(BodyKind::None);
5754+
(Synthesizer.Fn)(const_cast<AbstractFunctionDecl *>(this),
5755+
Synthesizer.Context);
5756+
}
5757+
if (getBodyKind() == BodyKind::Parsed ||
5758+
getBodyKind() == BodyKind::TypeChecked) {
5759+
return Body;
5760+
}
5761+
return nullptr;
5762+
}
57535763
void setBody(BraceStmt *S, BodyKind NewBodyKind = BodyKind::Parsed) {
57545764
assert(getBodyKind() != BodyKind::Skipped &&
57555765
"cannot set a body if it was skipped");
@@ -5774,12 +5784,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
57745784
}
57755785

57765786
/// Note that parsing for the body was delayed.
5777-
///
5778-
/// The function should return the body statement and a flag indicating
5779-
/// whether that body is already type-checked.
5780-
void setBodySynthesizer(
5781-
std::pair<BraceStmt *, bool> (* fn)(AbstractFunctionDecl *, void *),
5782-
void *context = nullptr) {
5787+
void setBodySynthesizer(void (* fn)(AbstractFunctionDecl *, void *),
5788+
void *context = nullptr) {
57835789
assert(getBodyKind() == BodyKind::None);
57845790
Synthesizer = {fn, context};
57855791
setBodyKind(BodyKind::Synthesize);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,10 @@ namespace swift {
540540
/// Class responsible for formatting diagnostics and presenting them
541541
/// to the user.
542542
class DiagnosticEngine {
543-
public:
544543
/// The source manager used to interpret source locations and
545544
/// display diagnostics.
546545
SourceManager &SourceMgr;
547546

548-
private:
549547
/// The diagnostic consumer(s) that will be responsible for actually
550548
/// emitting diagnostics.
551549
SmallVector<DiagnosticConsumer *, 2> Consumers;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ class ObjectLiteralExpr final
11311131

11321132
private:
11331133
Expr *Arg;
1134+
Expr *SemanticExpr;
11341135
SourceLoc PoundLoc;
11351136
ConcreteDeclRef Initializer;
11361137

@@ -1180,6 +1181,9 @@ class ObjectLiteralExpr final
11801181
return Bits.ObjectLiteralExpr.HasTrailingClosure;
11811182
}
11821183

1184+
Expr *getSemanticExpr() const { return SemanticExpr; }
1185+
void setSemanticExpr(Expr *expr) { SemanticExpr = expr; }
1186+
11831187
SourceLoc getSourceLoc() const { return PoundLoc; }
11841188
SourceRange getSourceRange() const {
11851189
return SourceRange(PoundLoc, Arg->getEndLoc());

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ namespace detail {
113113

114114
/// Extract the first, nearest source location from a tuple.
115115
template<unsigned Index, typename ...Types,
116-
typename = typename std::enable_if<sizeof...(Types) - Index
117-
? true
118-
: false>::type>
116+
typename = typename std::enable_if<Index < sizeof...(Types)>::type>
119117
SourceLoc extractNearestSourceLocTuple(const std::tuple<Types...> &value) {
120118
SourceLoc loc = maybeExtractNearestSourceLoc(std::get<Index>(value));
121119
if (loc.isValid())

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -689,28 +689,6 @@ class LazyStoragePropertyRequest :
689689
bool isCached() const { return true; }
690690
};
691691

692-
/// Request to type check the body of the given function.
693-
///
694-
/// Produces true if an error occurred, false otherwise.
695-
/// FIXME: it would be far better to return the type-checked body.
696-
class TypeCheckFunctionBodyRequest :
697-
public SimpleRequest<TypeCheckFunctionBodyRequest,
698-
bool(AbstractFunctionDecl *),
699-
CacheKind::Cached> {
700-
public:
701-
using SimpleRequest::SimpleRequest;
702-
703-
private:
704-
friend SimpleRequest;
705-
706-
// Evaluation.
707-
llvm::Expected<bool>
708-
evaluate(Evaluator &evaluator, AbstractFunctionDecl *func) const;
709-
710-
public:
711-
bool isCached() const { return true; }
712-
};
713-
714692
// Allow AnyValue to compare two Type values, even though Type doesn't
715693
// support ==.
716694
template<>

branches/rxwei-patch-1/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ SWIFT_TYPEID(SelfAccessKindRequest)
3939
SWIFT_TYPEID(IsGetterMutatingRequest)
4040
SWIFT_TYPEID(IsSetterMutatingRequest)
4141
SWIFT_TYPEID(OpaqueReadOwnershipRequest)
42-
SWIFT_TYPEID(LazyStoragePropertyRequest)
43-
SWIFT_TYPEID(TypeCheckFunctionBodyRequest)
42+
SWIFT_TYPEID(LazyStoragePropertyRequest)

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,9 @@ class NullablePtr {
5555
assert(Ptr && "Pointer wasn't checked for null!");
5656
return Ptr;
5757
}
58-
59-
T *getPtrOrNull() { return getPtrOr(nullptr); }
60-
const T *getPtrOrNull() const { return getPtrOr(nullptr); }
61-
62-
T *getPtrOr(T *defaultValue) { return Ptr ? Ptr : defaultValue; }
63-
const T *getPtrOr(const T *defaultValue) const {
64-
return Ptr ? Ptr : defaultValue;
65-
}
58+
59+
T *getPtrOrNull() { return Ptr; }
60+
const T *getPtrOrNull() const { return Ptr; }
6661

6762
explicit operator bool() const { return Ptr; }
6863

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,14 @@ class SourceManager {
231231
void verifyAllBuffers() const;
232232

233233
/// Translate line and column pair to the offset.
234+
/// If the column number is the maximum unsinged int, return the offset of the end of the line.
234235
llvm::Optional<unsigned> resolveFromLineCol(unsigned BufferId, unsigned Line,
235236
unsigned Col) const;
236237

238+
/// Translate the end position of the given line to the offset.
239+
llvm::Optional<unsigned> resolveOffsetForEndOfLine(unsigned BufferId,
240+
unsigned Line) const;
241+
237242
SourceLoc getLocForLineCol(unsigned BufferId, unsigned Line, unsigned Col) const {
238243
auto Offset = resolveFromLineCol(BufferId, Line, Col);
239244
return Offset.hasValue() ? getLocForOffset(BufferId, Offset.getValue()) :

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,15 +1775,15 @@ class SILBuilder {
17751775
//===--------------------------------------------------------------------===//
17761776

17771777
CondFailInst *createCondFail(SILLocation Loc, SILValue Operand,
1778-
StringRef Message, bool Inverted = false) {
1778+
bool Inverted = false) {
17791779
if (Inverted) {
17801780
SILType Ty = Operand->getType();
17811781
SILValue True(createIntegerLiteral(Loc, Ty, 1));
17821782
Operand =
17831783
createBuiltinBinaryFunction(Loc, "xor", Ty, Ty, {Operand, True});
17841784
}
1785-
return insert(CondFailInst::create(getSILDebugLocation(Loc), Operand,
1786-
Message, getModule()));
1785+
return insert(new (getModule())
1786+
CondFailInst(getSILDebugLocation(Loc), Operand));
17871787
}
17881788

17891789
BuiltinInst *createBuiltinTrap(SILLocation Loc) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,8 +2447,7 @@ SILCloner<ImplClass>::visitCondFailInst(CondFailInst *Inst) {
24472447
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
24482448
recordClonedInstruction(
24492449
Inst, getBuilder().createCondFail(getOpLocation(Inst->getLoc()),
2450-
getOpValue(Inst->getOperand()),
2451-
Inst->getMessage()));
2450+
getOpValue(Inst->getOperand())));
24522451
}
24532452

24542453
template<typename ImplClass>

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6715,28 +6715,14 @@ class ProjectExistentialBoxInst
67156715
//===----------------------------------------------------------------------===//
67166716

67176717
/// Trigger a runtime failure if the given Int1 value is true.
6718-
///
6719-
/// Optionally cond_fail has a static failure message, which is displayed in the debugger in case the failure
6720-
/// is triggered.
6721-
class CondFailInst final
6718+
class CondFailInst
67226719
: public UnaryInstructionBase<SILInstructionKind::CondFailInst,
6723-
NonValueInstruction>,
6724-
private llvm::TrailingObjects<CondFailInst, char>
6720+
NonValueInstruction>
67256721
{
6726-
friend TrailingObjects;
67276722
friend SILBuilder;
67286723

6729-
unsigned MessageSize;
6730-
6731-
CondFailInst(SILDebugLocation DebugLoc, SILValue Operand, StringRef Message);
6732-
6733-
static CondFailInst *create(SILDebugLocation DebugLoc, SILValue Operand,
6734-
StringRef Message, SILModule &M);
6735-
6736-
public:
6737-
StringRef getMessage() const {
6738-
return {getTrailingObjects<char>(), MessageSize};
6739-
}
6724+
CondFailInst(SILDebugLocation DebugLoc, SILValue Operand)
6725+
: UnaryInstructionBase(DebugLoc, Operand) {}
67406726
};
67416727

67426728
//===----------------------------------------------------------------------===//

branches/rxwei-patch-1/include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 501; // cond_fail messages
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 500; // dependency types for protocols
5656

5757
using DeclIDField = BCFixed<31>;
5858

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
19771977
printArgumentLabels(E->getArgumentLabels());
19781978
OS << "\n";
19791979
printRec(E->getArg());
1980+
printSemanticExpr(E->getSemanticExpr());
19801981
PrintWithColorRAII(OS, ParenthesisColor) << ')';
19811982
}
19821983

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ SourceRange AbstractFunctionDeclScope::getChildlessSourceRange() const {
301301
assert(r.End.isValid());
302302
return r;
303303
}
304-
return decl->getBodySourceRange();
304+
return decl->getBody()->getSourceRange();
305305
}
306306

307307
SourceRange AbstractFunctionParamsScope::getChildlessSourceRange() const {

0 commit comments

Comments
 (0)