Skip to content

Commit b247993

Browse files
committed
---
yaml --- r: 348650 b: refs/heads/master c: 97febd4 h: refs/heads/master
1 parent 38b3118 commit b247993

File tree

119 files changed

+1385
-868
lines changed

Some content is hidden

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

119 files changed

+1385
-868
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1ff1845330dcfc289bf6a77c12a79f29e302d12f
2+
refs/heads/master: 97febd42a9190367941d4e28884c1b0a9fa8ed59
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
118118
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AttributeNodes.py"
119119
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AvailabilityNodes.py"
120120
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CommonNodes.py"
121+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CompletionOnlyNodes.py"
121122
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/DeclNodes.py"
122123
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/ExprNodes.py"
123124
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/GenericNodes.py"

trunk/include/swift/AST/ASTTypeIDZone.def

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,27 @@
1414
// for use with the TypeID template.
1515
//
1616
//===----------------------------------------------------------------------===//
17-
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
18-
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)
19-
SWIFT_TYPEID_NAMED(ValueDecl *, ValueDecl)
20-
SWIFT_TYPEID_NAMED(ProtocolDecl *, ProtocolDecl)
21-
SWIFT_TYPEID_NAMED(Decl *, Decl)
22-
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
23-
SWIFT_TYPEID(Type)
24-
SWIFT_TYPEID(TypePair)
17+
18+
SWIFT_TYPEID(AncestryFlags)
19+
SWIFT_TYPEID(CtorInitializerKind)
2520
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
2621
SWIFT_TYPEID(PropertyWrapperTypeInfo)
27-
SWIFT_TYPEID(CtorInitializerKind)
22+
SWIFT_TYPEID(Requirement)
2823
SWIFT_TYPEID(ResilienceExpansion)
29-
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>, PropertyWrapperMutability)
24+
SWIFT_TYPEID(Type)
25+
SWIFT_TYPEID(TypePair)
3026
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
31-
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
32-
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)
33-
SWIFT_TYPEID(AncestryFlags)
27+
SWIFT_TYPEID_NAMED(Decl *, Decl)
28+
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
3429
SWIFT_TYPEID_NAMED(GenericSignature *, GenericSignature)
3530
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
36-
SWIFT_TYPEID(Requirement)
3731
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
38-
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
32+
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
33+
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
34+
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
35+
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
36+
PropertyWrapperMutability)
37+
SWIFT_TYPEID_NAMED(ProtocolDecl *, ProtocolDecl)
38+
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)
39+
SWIFT_TYPEID_NAMED(ValueDecl *, ValueDecl)
40+
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)

trunk/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-
SmallVector<GenericParamList *, 2>,
1097+
GenericParamList *,
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-
SmallVector<GenericParamList *, 2> addedParameters,
1113+
GenericParamList *gpl,
11141114
SmallVector<Requirement, 2> addedRequirements,
11151115
SmallVector<TypeLoc, 2> inferenceSources,
11161116
bool allowConcreteGenericParams) const;

trunk/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-
SmallVector<GenericParamList *, 2>,
57+
GenericParamList *,
5858
SmallVector<Requirement, 2>,
5959
SmallVector<TypeLoc, 2>, bool),
6060
Cached, NoLocationInfo)

trunk/include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def tbd_compatibility_version
8686
def tbd_compatibility_version_EQ : Joined<["-"], "tbd-compatibility-version=">,
8787
Alias<tbd_compatibility_version>;
8888

89+
def tbd_is_installapi: Flag<["-"], "tbd-is-installapi">,
90+
HelpText<"If the TBD file should indicate it's being generated during "
91+
"InstallAPI">;
92+
8993
def verify : Flag<["-"], "verify">,
9094
HelpText<"Verify diagnostics against expected-{error|warning|note} "
9195
"annotations">;

trunk/include/swift/Parse/ASTGen.h

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

4445
SourceLoc generate(const syntax::TokenSyntax &Tok, const SourceLoc Loc);
4546

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+
4671
public:
4772
//===--------------------------------------------------------------------===//
4873
// Expressions.
@@ -97,6 +122,10 @@ class ASTGen {
97122
const SourceLoc Loc);
98123
TypeRepr *generate(const syntax::ImplicitlyUnwrappedOptionalTypeSyntax &Type,
99124
const SourceLoc Loc);
125+
TypeRepr *generate(const syntax::ClassRestrictionTypeSyntax &Type,
126+
const SourceLoc Loc);
127+
TypeRepr *generate(const syntax::CodeCompletionTypeSyntax &Type,
128+
const SourceLoc Loc);
100129
TypeRepr *generate(const syntax::UnknownTypeSyntax &Type,
101130
const SourceLoc Loc);
102131

trunk/include/swift/Parse/CodeCompletionCallbacks.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class CodeCompletionCallbacks {
4040
/// completion. This declaration contained the code completion token.
4141
Decl *ParsedDecl = nullptr;
4242

43+
TypeLoc ParsedTypeLoc;
44+
4345
/// True if code completion is done inside a raw value expression of an enum
4446
/// case.
4547
bool InEnumElementRawValue = false;
@@ -76,6 +78,10 @@ class CodeCompletionCallbacks {
7678
ParsedDecl = D;
7779
}
7880

81+
void setParsedTypeLoc(TypeLoc TyLoc) {
82+
ParsedTypeLoc = TyLoc;
83+
}
84+
7985
void setLeadingSequenceExprs(ArrayRef<Expr *> exprs) {
8086
leadingSequenceExprs.assign(exprs.begin(), exprs.end());
8187
}
@@ -159,10 +165,10 @@ class CodeCompletionCallbacks {
159165
virtual void completeTypeSimpleBeginning() {};
160166

161167
/// Complete a given type-identifier after we have consumed the dot.
162-
virtual void completeTypeIdentifierWithDot(IdentTypeRepr *ITR) {};
168+
virtual void completeTypeIdentifierWithDot() {};
163169

164170
/// Complete a given type-identifier when there is no trailing dot.
165-
virtual void completeTypeIdentifierWithoutDot(IdentTypeRepr *ITR) {};
171+
virtual void completeTypeIdentifierWithoutDot() {};
166172

167173
/// Complete the beginning of a case statement at the top of switch stmt.
168174
virtual void completeCaseStmtKeyword() {};

trunk/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.getDeferredTokenRangeWithTrivia();
41+
auto Range = Node.getDeferredTokenRange();
4242
auto LeadingTriviaPieces = Node.getDeferredLeadingTriviaPieces();
4343
auto TrailingTriviaPieces = Node.getDeferredTrailingTriviaPieces();
4444

trunk/include/swift/Parse/ParsedSyntaxBuilders.h.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace swift {
3030
class ParsedRawSyntaxRecorder;
3131
class SyntaxParsingContext;
3232

33-
% for node in SYNTAX_NODES + SILONLY_NODES:
33+
% for node in SYNTAX_NODES + PARSEONLY_NODES:
3434
% if node.is_buildable():
3535
% child_count = len(node.children)
3636
class Parsed${node.name}Builder {

trunk/include/swift/Parse/ParsedSyntaxNodes.h.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ namespace swift {
2828
% # Emit the non-collection classes first, then emit the collection classes
2929
% # that reference these classes.
3030

31-
% for node in SYNTAX_NODES + SILONLY_NODES:
31+
% for node in SYNTAX_NODES + PARSEONLY_NODES:
3232
% if not node.is_syntax_collection():
3333
class Parsed${node.name};
3434
% end
3535
% end
3636

37-
% for node in SYNTAX_NODES + SILONLY_NODES:
37+
% for node in SYNTAX_NODES + PARSEONLY_NODES:
3838
% if node.is_syntax_collection():
3939
using Parsed${node.name} =
4040
ParsedSyntaxCollection<syntax::SyntaxKind::${node.syntax_kind}>;
4141
% end
4242
% end
4343

44-
% for node in SYNTAX_NODES + SILONLY_NODES:
44+
% for node in SYNTAX_NODES + PARSEONLY_NODES:
4545
% if not node.is_syntax_collection():
4646
% qualifier = "" if node.is_base() else "final"
4747
% for line in dedented_lines(node.description):

trunk/include/swift/Parse/ParsedSyntaxRecorder.h.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SyntaxParsingContext;
3131

3232
struct ParsedSyntaxRecorder {
3333

34-
% for node in SYNTAX_NODES + SILONLY_NODES:
34+
% for node in SYNTAX_NODES + PARSEONLY_NODES:
3535
% if node.children:
3636
% child_params = []
3737
% for child in node.children:

trunk/include/swift/Parse/Parser.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,23 @@ 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+
10071016
ParserResult<TypeDecl> parseDeclTypeAlias(ParseDeclOptions Flags,
1008-
DeclAttributes &Attributes);
1017+
DeclAttributes &Attributes,
1018+
SourceLoc leadingLoc);
10091019

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

10921103
ParserResult<ImportDecl> parseDeclImport(ParseDeclOptions Flags,
10931104
DeclAttributes &Attributes);
1094-
ParserStatus parseInheritance(SmallVectorImpl<TypeLoc> &Inherited,
1105+
ParserStatus parseInheritance(MutableArrayRef<TypeLoc> &Inherited,
10951106
bool allowClassRequirement,
10961107
bool allowAnyObject);
10971108
ParserStatus parseDeclItem(bool &PreviousHadSemi,

trunk/include/swift/Parse/SyntaxParsingContext.h

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

281281
/// Returns the topmost Syntax node.
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-
}
282+
template <typename SyntaxNode> SyntaxNode topNode();
290283

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

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+
379390
} // namespace swift
380391
#endif // SWIFT_SYNTAX_PARSING_CONTEXT_H

0 commit comments

Comments
 (0)