Skip to content

Commit f12e3ea

Browse files
committed
---
yaml --- r: 344319 b: refs/heads/master-rebranch c: 5b92814 h: refs/heads/master i: 344317: 993da03 344315: 87ffe22 344311: 7af9e2b 344303: cfe8592 344287: 4dd84d4 344255: cb65fda 344191: f6ec270 344063: 4710043
1 parent d1f6eb4 commit f12e3ea

Some content is hidden

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

48 files changed

+443
-674
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14551455
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14561456
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14571457
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1458-
refs/heads/master-rebranch: b520076aff48d7c15e7391b15d1df7864e11d6be
1458+
refs/heads/master-rebranch: 5b92814a0e852a2912fe68ff0d6992821c9eb1b3
14591459
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14601460
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14611461
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec

branches/master-rebranch/include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ class InferredGenericSignatureRequest :
10941094
public SimpleRequest<InferredGenericSignatureRequest,
10951095
GenericSignature *(ModuleDecl *,
10961096
GenericSignature *,
1097-
GenericParamList *,
1097+
SmallVector<GenericParamList *, 2>,
10981098
SmallVector<Requirement, 2>,
10991099
SmallVector<TypeLoc, 2>,
11001100
bool),
@@ -1110,7 +1110,7 @@ class InferredGenericSignatureRequest :
11101110
evaluate(Evaluator &evaluator,
11111111
ModuleDecl *module,
11121112
GenericSignature *baseSignature,
1113-
GenericParamList *gpl,
1113+
SmallVector<GenericParamList *, 2> addedParameters,
11141114
SmallVector<Requirement, 2> addedRequirements,
11151115
SmallVector<TypeLoc, 2> inferenceSources,
11161116
bool allowConcreteGenericParams) const;

branches/master-rebranch/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SWIFT_REQUEST(NameLookup, GenericSignatureRequest,
5454
SeparatelyCached, NoLocationInfo)
5555
SWIFT_REQUEST(TypeChecker, InferredGenericSignatureRequest,
5656
GenericSignature *(ModuleDecl *, GenericSignature *,
57-
GenericParamList *,
57+
SmallVector<GenericParamList *, 2>,
5858
SmallVector<Requirement, 2>,
5959
SmallVector<TypeLoc, 2>, bool),
6060
Cached, NoLocationInfo)

branches/master-rebranch/include/swift/Parse/ASTGen.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "swift/AST/ASTContext.h"
1717
#include "swift/AST/Decl.h"
1818
#include "swift/AST/Expr.h"
19-
#include "swift/AST/TypeRepr.h"
2019
#include "swift/Parse/PersistentParserState.h"
2120
#include "swift/Syntax/SyntaxNodes.h"
2221
#include "llvm/ADT/DenseMap.h"
@@ -44,30 +43,6 @@ class ASTGen {
4443

4544
SourceLoc generate(const syntax::TokenSyntax &Tok, const SourceLoc Loc);
4645

47-
SourceLoc generateIdentifierDeclName(const syntax::TokenSyntax &Tok,
48-
const SourceLoc, Identifier &Identifier);
49-
50-
public:
51-
//===--------------------------------------------------------------------===//
52-
// Decls.
53-
54-
Decl *generate(const syntax::DeclSyntax &Decl, const SourceLoc Loc);
55-
TypeDecl *generate(const syntax::AssociatedtypeDeclSyntax &Decl,
56-
const SourceLoc Loc);
57-
58-
TrailingWhereClause *generate(const syntax::GenericWhereClauseSyntax &syntax,
59-
const SourceLoc Loc);
60-
MutableArrayRef<TypeLoc>
61-
generate(const syntax::TypeInheritanceClauseSyntax &syntax,
62-
const SourceLoc Loc, bool allowClassRequirement);
63-
64-
private:
65-
DeclAttributes
66-
generateDeclAttributes(const syntax::DeclSyntax &D,
67-
const Optional<syntax::AttributeListSyntax> &attrs,
68-
const Optional<syntax::ModifierListSyntax> &modifiers,
69-
SourceLoc Loc, bool includeComments);
70-
7146
public:
7247
//===--------------------------------------------------------------------===//
7348
// Expressions.
@@ -122,8 +97,6 @@ class ASTGen {
12297
const SourceLoc Loc);
12398
TypeRepr *generate(const syntax::ImplicitlyUnwrappedOptionalTypeSyntax &Type,
12499
const SourceLoc Loc);
125-
TypeRepr *generate(const syntax::ClassRestrictionTypeSyntax &Type,
126-
const SourceLoc Loc);
127100
TypeRepr *generate(const syntax::CodeCompletionTypeSyntax &Type,
128101
const SourceLoc Loc);
129102
TypeRepr *generate(const syntax::UnknownTypeSyntax &Type,

branches/master-rebranch/include/swift/Parse/LibSyntaxGenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class LibSyntaxGenerator {
3838
assert(Node.isDeferredToken());
3939

4040
auto Kind = Node.getTokenKind();
41-
auto Range = Node.getDeferredTokenRange();
41+
auto Range = Node.getDeferredTokenRangeWithTrivia();
4242
auto LeadingTriviaPieces = Node.getDeferredLeadingTriviaPieces();
4343
auto TrailingTriviaPieces = Node.getDeferredTrailingTriviaPieces();
4444

branches/master-rebranch/include/swift/Parse/Parser.h

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,23 +1004,12 @@ class Parser {
10041004
bool delayParsingDeclList(SourceLoc LBLoc, SourceLoc &RBLoc,
10051005
IterableDeclContext *IDC);
10061006

1007-
ParsedSyntaxResult<ParsedTypeInheritanceClauseSyntax>
1008-
parseTypeInheritanceClauseSyntax(bool allowClassRequirement,
1009-
bool allowAnyObject);
1010-
1011-
ParsedSyntaxResult<ParsedDeclSyntax>
1012-
parseDeclAssociatedTypeSyntax(ParseDeclOptions flags,
1013-
Optional<ParsedAttributeListSyntax> attrs,
1014-
Optional<ParsedModifierListSyntax> modifiers);
1015-
10161007
ParserResult<TypeDecl> parseDeclTypeAlias(ParseDeclOptions Flags,
1017-
DeclAttributes &Attributes,
1018-
SourceLoc leadingLoc);
1008+
DeclAttributes &Attributes);
10191009

10201010
ParserResult<TypeDecl> parseDeclAssociatedType(ParseDeclOptions Flags,
1021-
DeclAttributes &Attributes,
1022-
SourceLoc leadingLoc);
1023-
1011+
DeclAttributes &Attributes);
1012+
10241013
/// Parse a #if ... #endif directive.
10251014
/// Delegate callback function to parse elements in the blocks.
10261015
ParserResult<IfConfigDecl> parseIfConfig(
@@ -1102,7 +1091,7 @@ class Parser {
11021091

11031092
ParserResult<ImportDecl> parseDeclImport(ParseDeclOptions Flags,
11041093
DeclAttributes &Attributes);
1105-
ParserStatus parseInheritance(MutableArrayRef<TypeLoc> &Inherited,
1094+
ParserStatus parseInheritance(SmallVectorImpl<TypeLoc> &Inherited,
11061095
bool allowClassRequirement,
11071096
bool allowAnyObject);
11081097
ParserStatus parseDeclItem(bool &PreviousHadSemi,

branches/master-rebranch/include/swift/Parse/SyntaxParsingContext.h

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,17 @@ class alignas(1 << SyntaxAlignInBits) SyntaxParsingContext {
279279
}
280280

281281
/// Returns the topmost Syntax node.
282-
template <typename SyntaxNode> SyntaxNode topNode();
282+
template <typename SyntaxNode> SyntaxNode topNode() {
283+
ParsedRawSyntaxNode &TopNode = getStorage().back();
284+
if (TopNode.isRecorded()) {
285+
OpaqueSyntaxNode OpaqueNode = TopNode.getOpaqueNode();
286+
return getSyntaxCreator().getLibSyntaxNodeFor<SyntaxNode>(OpaqueNode);
287+
}
288+
return getSyntaxCreator().createNode<SyntaxNode>(TopNode.copyDeferred());
289+
}
283290

284-
template <typename SyntaxNode> llvm::Optional<SyntaxNode> popIf() {
291+
template <typename SyntaxNode>
292+
llvm::Optional<SyntaxNode> popIf() {
285293
auto &Storage = getStorage();
286294
if (Storage.size() <= Offset)
287295
return llvm::None;
@@ -368,24 +376,5 @@ class alignas(1 << SyntaxAlignInBits) SyntaxParsingContext {
368376
"Only meant for use in the debugger");
369377
};
370378

371-
template <typename SyntaxNode>
372-
inline SyntaxNode SyntaxParsingContext::topNode() {
373-
ParsedRawSyntaxNode &TopNode = getStorage().back();
374-
if (TopNode.isRecorded()) {
375-
OpaqueSyntaxNode OpaqueNode = TopNode.getOpaqueNode();
376-
return getSyntaxCreator().getLibSyntaxNodeFor<SyntaxNode>(OpaqueNode);
377-
}
378-
return getSyntaxCreator().createNode<SyntaxNode>(TopNode.copyDeferred());
379-
}
380-
381-
template <> inline TokenSyntax SyntaxParsingContext::topNode<TokenSyntax>() {
382-
ParsedRawSyntaxNode &TopNode = getStorage().back();
383-
if (TopNode.isRecorded()) {
384-
OpaqueSyntaxNode OpaqueNode = TopNode.getOpaqueNode();
385-
return getSyntaxCreator().getLibSyntaxNodeFor<TokenSyntax>(OpaqueNode);
386-
}
387-
return getSyntaxCreator().createToken(TopNode.copyDeferred());
388-
}
389-
390379
} // namespace swift
391380
#endif // SWIFT_SYNTAX_PARSING_CONTEXT_H

branches/master-rebranch/include/swift/SIL/ApplySite.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,8 @@ class ApplySite {
130130
llvm_unreachable("covered switch"); \
131131
} while (0)
132132

133-
/// Return the callee operand as a value.
134-
SILValue getCallee() const { return getCalleeOperand()->get(); }
135-
136133
/// Return the callee operand.
137-
const Operand *getCalleeOperand() const {
138-
FOREACH_IMPL_RETURN(getCalleeOperand());
139-
}
134+
SILValue getCallee() const { FOREACH_IMPL_RETURN(getCallee()); }
140135

141136
/// Return the callee value by looking through function conversions until we
142137
/// find a function_ref, partial_apply, or unrecognized callee value.

branches/master-rebranch/include/swift/SIL/BranchPropagatedUser.h

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,17 @@ class BranchPropagatedUser {
3131
InnerTy user;
3232

3333
public:
34-
BranchPropagatedUser(Operand *op) : user() {
35-
auto *opUser = op->getUser();
36-
auto *cbi = dyn_cast<CondBranchInst>(opUser);
37-
if (!cbi) {
38-
user = InnerTy(opUser, 0);
39-
return;
40-
}
41-
unsigned operandIndex = op->getOperandNumber();
42-
if (cbi->isConditionOperandIndex(operandIndex)) {
43-
// TODO: Is this correct?
44-
user = InnerTy(cbi, CondBranchInst::TrueIdx);
45-
return;
46-
}
47-
bool isTrueOperand = cbi->isTrueOperandIndex(operandIndex);
48-
if (isTrueOperand) {
49-
user = InnerTy(cbi, CondBranchInst::TrueIdx);
50-
} else {
51-
user = InnerTy(cbi, CondBranchInst::FalseIdx);
52-
}
34+
BranchPropagatedUser(SILInstruction *inst) : user(inst) {
35+
assert(!isa<CondBranchInst>(inst));
36+
}
37+
38+
BranchPropagatedUser(CondBranchInst *cbi) : user(cbi) {}
39+
40+
BranchPropagatedUser(CondBranchInst *cbi, unsigned successorIndex)
41+
: user(cbi, successorIndex) {
42+
assert(successorIndex == CondBranchInst::TrueIdx ||
43+
successorIndex == CondBranchInst::FalseIdx);
5344
}
54-
BranchPropagatedUser(const Operand *op)
55-
: BranchPropagatedUser(const_cast<Operand *>(op)) {}
5645

5746
BranchPropagatedUser(const BranchPropagatedUser &other) : user(other.user) {}
5847
BranchPropagatedUser &operator=(const BranchPropagatedUser &other) {
@@ -107,19 +96,6 @@ class BranchPropagatedUser {
10796
NumLowBitsAvailable =
10897
llvm::PointerLikeTypeTraits<InnerTy>::NumLowBitsAvailable
10998
};
110-
111-
private:
112-
BranchPropagatedUser(SILInstruction *inst) : user(inst) {
113-
assert(!isa<CondBranchInst>(inst));
114-
}
115-
116-
BranchPropagatedUser(CondBranchInst *cbi) : user(cbi) {}
117-
118-
BranchPropagatedUser(CondBranchInst *cbi, unsigned successorIndex)
119-
: user(cbi, successorIndex) {
120-
assert(successorIndex == CondBranchInst::TrueIdx ||
121-
successorIndex == CondBranchInst::FalseIdx);
122-
}
12399
};
124100

125101
} // namespace swift

branches/master-rebranch/include/swift/SIL/OwnershipUtils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,14 @@ struct BorrowScopeIntroducingValue {
310310
/// called with a scope that is not local.
311311
///
312312
/// The intention is that this method can be used instead of
313-
/// BorrowScopeIntroducingValue::getLocalScopeEndingUses() to avoid
313+
/// BorrowScopeIntroducingValue::getLocalScopeEndingInstructions() to avoid
314314
/// introducing an intermediate array when one needs to transform the
315315
/// instructions before storing them.
316316
///
317317
/// NOTE: To determine if a scope is a local scope, call
318318
/// BorrowScopeIntoducingValue::isLocalScope().
319-
void visitLocalScopeEndingUses(function_ref<void(Operand *)> visitor) const;
319+
void visitLocalScopeEndingInstructions(
320+
function_ref<void(SILInstruction *)> visitor) const;
320321

321322
bool isLocalScope() const { return kind.isLocalScope(); }
322323

branches/master-rebranch/include/swift/SIL/SILBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ class SILBuilder {
403403
Optional<SILDebugVariable> Var = None,
404404
bool hasDynamicLifetime = false) {
405405
Loc.markAsPrologue();
406+
assert((!dyn_cast_or_null<VarDecl>(Loc.getAsASTNode<Decl>()) || Var) &&
407+
"location is a VarDecl, but SILDebugVariable is empty");
406408
return insert(AllocStackInst::create(getSILDebugLocation(Loc), elementType,
407409
getFunction(), C.OpenedArchetypes,
408410
Var, hasDynamicLifetime));
@@ -443,6 +445,8 @@ class SILBuilder {
443445
Optional<SILDebugVariable> Var = None,
444446
bool hasDynamicLifetime = false) {
445447
Loc.markAsPrologue();
448+
assert((!dyn_cast_or_null<VarDecl>(Loc.getAsASTNode<Decl>()) || Var) &&
449+
"location is a VarDecl, but SILDebugVariable is empty");
446450
return insert(AllocBoxInst::create(getSILDebugLocation(Loc), BoxType, *F,
447451
C.OpenedArchetypes, Var,
448452
hasDynamicLifetime));

branches/master-rebranch/include/swift/SIL/SILCloner.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,16 @@ template<typename ImplClass>
784784
void
785785
SILCloner<ImplClass>::visitAllocStackInst(AllocStackInst *Inst) {
786786
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
787-
recordClonedInstruction(
788-
Inst, getBuilder().createAllocStack(getOpLocation(Inst->getLoc()),
789-
getOpType(Inst->getElementType())));
787+
// Drop the debug info from mandatory-inlined instructions. It's the law!
788+
SILLocation Loc = getOpLocation(Inst->getLoc());
789+
Optional<SILDebugVariable> VarInfo = Inst->getVarInfo();
790+
if (Loc.getKind() == SILLocation::MandatoryInlinedKind) {
791+
Loc = MandatoryInlinedLocation::getAutoGeneratedLocation();
792+
VarInfo = None;
793+
}
794+
recordClonedInstruction(Inst,
795+
getBuilder().createAllocStack(
796+
Loc, getOpType(Inst->getElementType()), VarInfo));
790797
}
791798

792799
template<typename ImplClass>
@@ -829,11 +836,19 @@ template<typename ImplClass>
829836
void
830837
SILCloner<ImplClass>::visitAllocBoxInst(AllocBoxInst *Inst) {
831838
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
839+
// Drop the debug info from mandatory-inlined instructions.
840+
SILLocation Loc = getOpLocation(Inst->getLoc());
841+
Optional<SILDebugVariable> VarInfo = Inst->getVarInfo();
842+
if (Loc.getKind() == SILLocation::MandatoryInlinedKind) {
843+
Loc = MandatoryInlinedLocation::getAutoGeneratedLocation();
844+
VarInfo = None;
845+
}
846+
832847
recordClonedInstruction(
833848
Inst,
834849
getBuilder().createAllocBox(
835-
getOpLocation(Inst->getLoc()),
836-
this->getOpType(Inst->getType()).template castTo<SILBoxType>()));
850+
Loc, this->getOpType(Inst->getType()).template castTo<SILBoxType>(),
851+
VarInfo));
837852
}
838853

839854
template<typename ImplClass>

branches/master-rebranch/include/swift/SIL/SILInstruction.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,14 +1315,18 @@ class UnaryInstructionWithTypeDependentOperandsBase
13151315
/// arguments that are needed by DebugValueInst, DebugValueAddrInst,
13161316
/// AllocStackInst, and AllocBoxInst.
13171317
struct SILDebugVariable {
1318+
StringRef Name;
1319+
unsigned ArgNo : 16;
1320+
unsigned Constant : 1;
1321+
13181322
SILDebugVariable() : ArgNo(0), Constant(false) {}
13191323
SILDebugVariable(bool Constant, uint16_t ArgNo)
13201324
: ArgNo(ArgNo), Constant(Constant) {}
13211325
SILDebugVariable(StringRef Name, bool Constant, unsigned ArgNo)
13221326
: Name(Name), ArgNo(ArgNo), Constant(Constant) {}
1323-
StringRef Name;
1324-
unsigned ArgNo : 16;
1325-
unsigned Constant : 1;
1327+
bool operator==(const SILDebugVariable &V) {
1328+
return ArgNo == V.ArgNo && Constant == V.Constant && Name == V.Name;
1329+
}
13261330
};
13271331

13281332
/// A DebugVariable where storage for the strings has been
@@ -1861,8 +1865,7 @@ class ApplyInstBase<Impl, Base, false> : public Base {
18611865
/// The operand number of the first argument.
18621866
static unsigned getArgumentOperandNumber() { return NumStaticOperands; }
18631867

1864-
const Operand *getCalleeOperand() const { return &getAllOperands()[Callee]; }
1865-
SILValue getCallee() const { return getCalleeOperand()->get(); }
1868+
SILValue getCallee() const { return getAllOperands()[Callee].get(); }
18661869

18671870
/// Gets the origin of the callee by looking through function type conversions
18681871
/// until we find a function_ref, partial_apply, or unrecognized value.
@@ -7213,10 +7216,7 @@ class CondBranchInst final
72137216
ProfileCounter FalseBBCount, SILFunction &F);
72147217

72157218
public:
7216-
const Operand *getConditionOperand() const {
7217-
return &getAllOperands()[ConditionIdx];
7218-
}
7219-
SILValue getCondition() const { return getConditionOperand()->get(); }
7219+
SILValue getCondition() const { return getAllOperands()[ConditionIdx].get(); }
72207220
void setCondition(SILValue newCondition) {
72217221
getAllOperands()[ConditionIdx].set(newCondition);
72227222
}
@@ -7262,11 +7262,6 @@ class CondBranchInst final
72627262
return getAllOperands().slice(NumFixedOpers + getNumTrueArgs());
72637263
}
72647264

7265-
/// Returns true if \p op is mapped to the condition operand of the cond_br.
7266-
bool isConditionOperand(Operand *op) const {
7267-
return getConditionOperand() == op;
7268-
}
7269-
72707265
bool isConditionOperandIndex(unsigned OpIndex) const {
72717266
assert(OpIndex < getNumOperands() &&
72727267
"OpIndex must be an index for an actual operand");

branches/master-rebranch/include/swift/SIL/SILLocation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ class MandatoryInlinedLocation : public SILLocation {
662662
: SILLocation(L, MandatoryInlinedKind) {}
663663

664664
static MandatoryInlinedLocation getMandatoryInlinedLocation(SILLocation L);
665+
static MandatoryInlinedLocation getAutoGeneratedLocation();
665666

666667
static MandatoryInlinedLocation getModuleLocation(unsigned Flags) {
667668
auto L = MandatoryInlinedLocation();

branches/master-rebranch/include/swift/Syntax/Syntax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Syntax {
8383
SyntaxKind getKind() const;
8484

8585
/// Get the shared raw syntax.
86-
const RC<RawSyntax> &getRaw() const;
86+
RC<RawSyntax> getRaw() const;
8787

8888
/// Get an ID for this node that is stable across incremental parses
8989
SyntaxNodeId getId() const { return getRaw()->getId(); }

0 commit comments

Comments
 (0)