Skip to content

Commit 1aefc13

Browse files
authored
---
yaml --- r: 349162 b: refs/heads/master-next c: dd7d925 h: refs/heads/master
1 parent 1800d5d commit 1aefc13

Some content is hidden

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

50 files changed

+1313
-735
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 0df6b40710e185fa510e6e71586c7920fa7bce8b
3+
refs/heads/master-next: dd7d9256109002f5c0347973f997c82fc2965714
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ Swift Next
145145
Swift 5.1
146146
---------
147147

148+
### 2019-09-20 (Xcode 11.0)
149+
148150
* [SR-8974][]:
149151

150152
Duplicate tuple element labels are no longer allowed, because it leads

branches/master-next/include/swift/AST/ASTTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ SWIFT_TYPEID_NAMED(Decl *, Decl)
2828
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
2929
SWIFT_TYPEID_NAMED(GenericSignature *, GenericSignature)
3030
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
31+
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3132
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
3233
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
3334
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
3435
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3536
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
3637
PropertyWrapperMutability)
38+
SWIFT_TYPEID_NAMED(PrecedenceGroupDecl *, PrecedenceGroupDecl)
3739
SWIFT_TYPEID_NAMED(ProtocolDecl *, ProtocolDecl)
3840
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)
3941
SWIFT_TYPEID_NAMED(ValueDecl *, ValueDecl)

branches/master-next/include/swift/AST/ASTTypeIDs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ class Decl;
2626
class GenericParamList;
2727
class GenericSignature;
2828
class GenericTypeParamType;
29+
class InfixOperatorDecl;
2930
class IterableDeclContext;
3031
class ModuleDecl;
3132
class NominalTypeDecl;
3233
class OperatorDecl;
34+
class PrecedenceGroupDecl;
3335
struct PropertyWrapperBackingPropertyInfo;
3436
struct PropertyWrapperTypeInfo;
3537
enum class CtorInitializerKind;

branches/master-next/include/swift/AST/Decl.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6900,7 +6900,6 @@ class OperatorDecl : public Decl {
69006900
/// \endcode
69016901
class InfixOperatorDecl : public OperatorDecl {
69026902
SourceLoc ColonLoc;
6903-
PrecedenceGroupDecl *PrecedenceGroup = nullptr;
69046903

69056904
public:
69066905
InfixOperatorDecl(DeclContext *DC, SourceLoc operatorLoc, Identifier name,
@@ -6911,14 +6910,6 @@ class InfixOperatorDecl : public OperatorDecl {
69116910
identifiers, identifierLocs),
69126911
ColonLoc(colonLoc) {}
69136912

6914-
InfixOperatorDecl(DeclContext *DC, SourceLoc operatorLoc, Identifier name,
6915-
SourceLoc nameLoc, SourceLoc colonLoc,
6916-
PrecedenceGroupDecl *precedenceGroup,
6917-
ArrayRef<NominalTypeDecl *> designatedNominalTypes)
6918-
: OperatorDecl(DeclKind::InfixOperator, DC, operatorLoc, name, nameLoc,
6919-
designatedNominalTypes),
6920-
ColonLoc(colonLoc), PrecedenceGroup(precedenceGroup) {}
6921-
69226913
SourceLoc getEndLoc() const {
69236914
auto identifierLocs = getIdentifierLocs();
69246915
if (identifierLocs.empty())
@@ -6933,10 +6924,7 @@ class InfixOperatorDecl : public OperatorDecl {
69336924

69346925
SourceLoc getColonLoc() const { return ColonLoc; }
69356926

6936-
PrecedenceGroupDecl *getPrecedenceGroup() const { return PrecedenceGroup; }
6937-
void setPrecedenceGroup(PrecedenceGroupDecl *PGD) {
6938-
PrecedenceGroup = PGD;
6939-
}
6927+
PrecedenceGroupDecl *getPrecedenceGroup() const;
69406928

69416929
/// True if this decl's attributes conflict with those declared by another
69426930
/// operator.

branches/master-next/include/swift/AST/NameLookupRequests.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "swift/AST/SimpleRequest.h"
2020
#include "swift/AST/ASTTypeIDs.h"
2121
#include "swift/Basic/Statistic.h"
22+
#include "llvm/ADT/Hashing.h"
2223
#include "llvm/ADT/TinyPtrVector.h"
2324

2425
namespace swift {
@@ -273,6 +274,56 @@ class GenericParamListRequest :
273274
void cacheResult(GenericParamList *value) const;
274275
};
275276

277+
struct PrecedenceGroupDescriptor {
278+
DeclContext *dc;
279+
Identifier ident;
280+
SourceLoc nameLoc;
281+
282+
SourceLoc getLoc() const;
283+
284+
friend llvm::hash_code hash_value(const PrecedenceGroupDescriptor &owner) {
285+
return hash_combine(llvm::hash_value(owner.dc),
286+
llvm::hash_value(owner.ident.getAsOpaquePointer()),
287+
llvm::hash_value(owner.nameLoc.getOpaquePointerValue()));
288+
}
289+
290+
friend bool operator==(const PrecedenceGroupDescriptor &lhs,
291+
const PrecedenceGroupDescriptor &rhs) {
292+
return lhs.dc == rhs.dc &&
293+
lhs.ident == rhs.ident &&
294+
lhs.nameLoc == rhs.nameLoc;
295+
}
296+
297+
friend bool operator!=(const PrecedenceGroupDescriptor &lhs,
298+
const PrecedenceGroupDescriptor &rhs) {
299+
return !(lhs == rhs);
300+
}
301+
};
302+
303+
void simple_display(llvm::raw_ostream &out, const PrecedenceGroupDescriptor &d);
304+
305+
class LookupPrecedenceGroupRequest
306+
: public SimpleRequest<LookupPrecedenceGroupRequest,
307+
PrecedenceGroupDecl *(PrecedenceGroupDescriptor),
308+
CacheKind::Cached> {
309+
public:
310+
using SimpleRequest::SimpleRequest;
311+
312+
private:
313+
friend SimpleRequest;
314+
315+
// Evaluation.
316+
llvm::Expected<PrecedenceGroupDecl *>
317+
evaluate(Evaluator &evaluator, PrecedenceGroupDescriptor descriptor) const;
318+
319+
public:
320+
// Source location
321+
SourceLoc getNearestLoc() const;
322+
323+
// Separate caching.
324+
bool isCached() const { return true; }
325+
};
326+
276327
#define SWIFT_TYPEID_ZONE NameLookup
277328
#define SWIFT_TYPEID_HEADER "swift/AST/NameLookupTypeIDZone.def"
278329
#include "swift/Basic/DefineTypeIDZone.h"

branches/master-next/include/swift/AST/NameLookupTypeIDZone.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ SWIFT_REQUEST(NameLookup, InheritedDeclsReferencedRequest,
3030
DirectlyReferencedTypeDecls(
3131
llvm::PointerUnion<TypeDecl *, ExtensionDecl *>, unsigned),
3232
Uncached, HasNearestLocation)
33+
SWIFT_REQUEST(NameLookup, LookupPrecedenceGroupRequest,
34+
PrecedenceGroupDecl *(DeclContext *, Identifier, SourceLoc),
35+
Cached, NoLocationInfo)
3336
SWIFT_REQUEST(NameLookup, SelfBoundsFromWhereClauseRequest,
3437
SelfBounds(llvm::PointerUnion<TypeDecl *, ExtensionDecl *>),
3538
Uncached, NoLocationInfo)

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class AbstractStorageDecl;
3333
class AccessorDecl;
3434
enum class AccessorKind;
3535
class GenericParamList;
36+
class PrecedenceGroupDecl;
3637
struct PropertyWrapperBackingPropertyInfo;
3738
struct PropertyWrapperMutability;
3839
class RequirementRepr;
@@ -1209,6 +1210,25 @@ class UnderlyingTypeRequest :
12091210
void cacheResult(Type value) const;
12101211
};
12111212

1213+
class OperatorPrecedenceGroupRequest
1214+
: public SimpleRequest<OperatorPrecedenceGroupRequest,
1215+
PrecedenceGroupDecl *(InfixOperatorDecl *),
1216+
CacheKind::Cached> {
1217+
public:
1218+
using SimpleRequest::SimpleRequest;
1219+
1220+
private:
1221+
friend SimpleRequest;
1222+
1223+
// Evaluation.
1224+
llvm::Expected<PrecedenceGroupDecl *>
1225+
evaluate(Evaluator &evaluator, InfixOperatorDecl *PGD) const;
1226+
1227+
public:
1228+
// Separate caching.
1229+
bool isCached() const { return true; }
1230+
};
1231+
12121232
// Allow AnyValue to compare two Type values, even though Type doesn't
12131233
// support ==.
12141234
template<>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ SWIFT_REQUEST(TypeChecker, MangleLocalTypeDeclRequest,
8585
SWIFT_REQUEST(TypeChecker, OpaqueReadOwnershipRequest,
8686
OpaqueReadOwnership(AbstractStorageDecl *), SeparatelyCached,
8787
NoLocationInfo)
88+
SWIFT_REQUEST(TypeChecker, OperatorPrecedenceGroupRequest,
89+
PrecedenceGroupDecl *(PrecedenceGroupDecl *),
90+
Cached, NoLocationInfo)
8891
SWIFT_REQUEST(TypeChecker, OverriddenDeclsRequest,
8992
llvm::TinyPtrVector<ValueDecl *>(ValueDecl *), SeparatelyCached,
9093
NoLocationInfo)

branches/master-next/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-next/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-next/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-next/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-next/include/swift/Remote/MetadataReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ class MetadataReader {
787787
baseSize = sizeof(TargetAnonymousContextDescriptor<Runtime>);
788788
if (AnonymousContextDescriptorFlags(flags.getKindSpecificFlags())
789789
.hasMangledName()) {
790-
baseSize += sizeof(TargetMangledContextName<Runtime>);
790+
metadataInitSize = sizeof(TargetMangledContextName<Runtime>);
791791
}
792792
break;
793793
case ContextDescriptorKind::Class:

0 commit comments

Comments
 (0)