Skip to content

Commit ef06b3d

Browse files
committed
---
yaml --- r: 348949 b: refs/heads/master c: a58a980 h: refs/heads/master i: 348947: 9a3f606
1 parent cb9fe7b commit ef06b3d

File tree

73 files changed

+915
-1280
lines changed

Some content is hidden

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

73 files changed

+915
-1280
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: ce7aa3c81e0bff6564a7c0a9279167461c35d22a
2+
refs/heads/master: a58a98087aa4ff2f65cc888761429b63c15258de
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/.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

trunk/cmake/modules/SwiftSource.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,6 @@ function(_compile_swift_files
333333
"-emit-module-interface-path" "${interface_file}")
334334
endif()
335335

336-
if (NOT SWIFTFILE_IS_STDLIB_CORE)
337-
list(APPEND swift_module_flags
338-
"-Xfrontend" "-experimental-skip-non-inlinable-function-bodies")
339-
endif()
340-
341336
# If we have extra regexp flags, check if we match any of the regexps. If so
342337
# add the relevant flags to our swift_flags.
343338
if (SWIFT_EXPERIMENTAL_EXTRA_REGEXP_FLAGS OR SWIFT_EXPERIMENTAL_EXTRA_NEGATIVE_REGEXP_FLAGS)

trunk/include/swift/AST/Attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ class DeclAttributes {
16721672
public:
16731673
template <typename ATTR, bool AllowInvalid>
16741674
using AttributeKindRange =
1675-
OptionalTransformRange<iterator_range<const_iterator>,
1675+
OptionalTransformRange<llvm::iterator_range<const_iterator>,
16761676
ToAttributeKind<ATTR, AllowInvalid>,
16771677
const_iterator>;
16781678

trunk/include/swift/AST/DeclContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class DeclIterator {
667667

668668
/// The range of declarations stored within an iterable declaration
669669
/// context.
670-
using DeclRange = iterator_range<DeclIterator>;
670+
typedef IteratorRange<DeclIterator> DeclRange;
671671

672672
/// The kind of an \c IterableDeclContext.
673673
enum class IterableDeclContextKind : uint8_t {

trunk/include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,6 @@ ERROR(expected_expr_throw,PointsToFirstBadToken,
970970
// Yield Statment
971971
ERROR(expected_expr_yield,PointsToFirstBadToken,
972972
"expected expression in 'yield' statement", ())
973-
ERROR(unexpected_arg_label_yield,none,
974-
"unexpected argument label in 'yield' statement", ())
975973

976974
// Defer Statement
977975
ERROR(expected_lbrace_after_defer,PointsToFirstBadToken,

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,8 +3493,6 @@ ERROR(single_tuple_parameter_mismatch_special,none,
34933493
ERROR(single_tuple_parameter_mismatch_normal,none,
34943494
"%0 %1 expects a single parameter of type %2%3",
34953495
(DescriptiveDeclKind, DeclBaseName, Type, StringRef))
3496-
NOTE(note_maybe_forgot_to_form_tuple,none,
3497-
"did you mean to pass a tuple?", ())
34983496
ERROR(unknown_single_tuple_parameter_mismatch,none,
34993497
"single parameter of type %0 is expected in call", (Type))
35003498
ERROR(cannot_convert_single_tuple_into_multiple_arguments,none,

trunk/include/swift/AST/TypeRepr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ struct TupleTypeReprElement {
653653
TypeRepr *Type;
654654
SourceLoc TrailingCommaLoc;
655655

656-
TupleTypeReprElement(): Type(nullptr) {}
656+
TupleTypeReprElement() {}
657657
TupleTypeReprElement(TypeRepr *Type): Type(Type) {}
658658
};
659659

trunk/include/swift/AST/Types.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,11 +3965,13 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
39653965
};
39663966
using IndirectFormalResultIter =
39673967
llvm::filter_iterator<const SILResultInfo *, IndirectFormalResultFilter>;
3968-
using IndirectFormalResultRange = iterator_range<IndirectFormalResultIter>;
3968+
using IndirectFormalResultRange = IteratorRange<IndirectFormalResultIter>;
39693969

39703970
/// A range of SILResultInfo for all formally indirect results.
39713971
IndirectFormalResultRange getIndirectFormalResults() const {
3972-
return llvm::make_filter_range(getResults(), IndirectFormalResultFilter());
3972+
auto filter =
3973+
llvm::make_filter_range(getResults(), IndirectFormalResultFilter());
3974+
return makeIteratorRange(filter.begin(), filter.end());
39733975
}
39743976

39753977
struct DirectFormalResultFilter {
@@ -3979,11 +3981,13 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
39793981
};
39803982
using DirectFormalResultIter =
39813983
llvm::filter_iterator<const SILResultInfo *, DirectFormalResultFilter>;
3982-
using DirectFormalResultRange = iterator_range<DirectFormalResultIter>;
3984+
using DirectFormalResultRange = IteratorRange<DirectFormalResultIter>;
39833985

39843986
/// A range of SILResultInfo for all formally direct results.
39853987
DirectFormalResultRange getDirectFormalResults() const {
3986-
return llvm::make_filter_range(getResults(), DirectFormalResultFilter());
3988+
auto filter =
3989+
llvm::make_filter_range(getResults(), DirectFormalResultFilter());
3990+
return makeIteratorRange(filter.begin(), filter.end());
39873991
}
39883992

39893993
/// Get a single non-address SILType that represents all formal direct

trunk/include/swift/Basic/BlotSetVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ class BlotSetVector {
6767

6868
ArrayRef<Optional<ValueT>> getArray() const { return vector; }
6969

70-
iterator_range<const_iterator> getRange() const {
70+
llvm::iterator_range<const_iterator> getRange() const {
7171
return {begin(), end()};
7272
}
7373

7474
using const_reverse_iterator = typename VectorT::const_reverse_iterator;
7575
const_reverse_iterator rbegin() const { return vector.rbegin(); }
7676
const_reverse_iterator rend() const { return vector.rend(); }
77-
iterator_range<const_reverse_iterator> getReverseRange() const {
77+
llvm::iterator_range<const_reverse_iterator> getReverseRange() const {
7878
return {rbegin(), rend()};
7979
}
8080

trunk/include/swift/Basic/LLVM.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ namespace llvm {
4343
template<typename T> class TinyPtrVector;
4444
template<typename T> class Optional;
4545
template <typename ...PTs> class PointerUnion;
46-
template <typename IteratorT> class iterator_range;
4746
class SmallBitVector;
4847

4948
// Other common classes.
@@ -64,7 +63,6 @@ namespace swift {
6463

6564
// Containers.
6665
using llvm::ArrayRef;
67-
using llvm::iterator_range;
6866
using llvm::MutableArrayRef;
6967
using llvm::None;
7068
using llvm::Optional;

trunk/include/swift/Basic/Range.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
namespace swift {
4646
using llvm::make_range;
47+
using llvm::iterator_range;
4748

4849
template<typename T>
4950
inline auto reversed(T &&container)

trunk/include/swift/Basic/STLExtras.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,37 @@ inline Iterator prev_or_begin(Iterator it, Iterator begin) {
251251

252252
/// @}
253253

254+
/// A range of iterators.
255+
/// TODO: Add `llvm::iterator_range::empty()`, then remove this helper, along
256+
/// with the superfluous TransformIterator.
257+
template<typename Iterator>
258+
class IteratorRange {
259+
Iterator First, Last;
260+
261+
public:
262+
using iterator = Iterator;
263+
264+
IteratorRange(Iterator first, Iterator last) : First(first), Last(last) { }
265+
iterator begin() const { return First; }
266+
iterator end() const { return Last; }
267+
bool empty() const { return First == Last; }
268+
269+
typename std::iterator_traits<iterator>::value_type front() const {
270+
assert(!empty() && "Front of empty range");
271+
return *begin();
272+
}
273+
};
274+
275+
/// Create a new iterator range.
276+
template<typename Iterator>
277+
inline IteratorRange<Iterator>
278+
makeIteratorRange(Iterator first, Iterator last) {
279+
return IteratorRange<Iterator>(first, last);
280+
}
254281

255282
/// An iterator that transforms the result of an underlying bidirectional
256283
/// iterator with a given operation.
257284
///
258-
/// Slightly different semantics from llvm::map_iterator, but we should
259-
/// probably figure out how to merge them eventually.
260-
///
261285
/// \tparam Iterator the underlying iterator.
262286
///
263287
/// \tparam Operation A function object that transforms the underlying

trunk/include/swift/Parse/ASTGen.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ class ASTGen {
3737

3838
// FIXME: remove when Syntax can represent all types and ASTGen can handle
3939
// them
40-
/// Exprs that cannot be represented by Syntax or generated by ASTGen.
41-
llvm::DenseMap<SourceLoc, Expr *> Exprs;
42-
4340
/// Decl attributes that cannot be represented by Syntax or generated by
4441
/// ASTGen.
4542
llvm::DenseMap<SourceLoc, DeclAttributes> ParsedDeclAttrs;
@@ -84,10 +81,6 @@ class ASTGen {
8481

8582
Expr *generate(const syntax::ExprSyntax &Expr, const SourceLoc Loc);
8683
Expr *generate(const syntax::IdentifierExprSyntax &Expr, const SourceLoc Loc);
87-
Expr *generate(const syntax::SuperRefExprSyntax &Expr, const SourceLoc Loc);
88-
Expr *generate(const syntax::ArrayExprSyntax &Expr, const SourceLoc Loc);
89-
Expr *generate(const syntax::DictionaryExprSyntax &Expr, const SourceLoc Loc);
90-
Expr *generate(const syntax::TupleExprSyntax &E, const SourceLoc Loc);
9184
Expr *generate(const syntax::EditorPlaceholderExprSyntax &Expr,
9285
const SourceLoc Loc);
9386
Expr *generate(const syntax::SpecializeExprSyntax &Expr, const SourceLoc Loc);
@@ -113,14 +106,7 @@ class ASTGen {
113106
const Optional<syntax::DeclNameArgumentsSyntax> &args,
114107
const SourceLoc Loc);
115108

116-
void generateExprTupleElementList(const syntax::TupleExprElementListSyntax &elements,
117-
const SourceLoc Loc, bool isForCallArguments,
118-
SmallVectorImpl<Expr *> &exprs,
119-
SmallVectorImpl<Identifier> &exprLabels,
120-
SmallVectorImpl<SourceLoc> &exprLabelLocs);
121-
122109
private:
123-
void validateCollectionElement(Expr *elementExpr);
124110

125111
Expr *generateMagicIdentifierLiteralExpression(
126112
const syntax::TokenSyntax &PoundToken, const SourceLoc Loc);
@@ -224,13 +210,6 @@ class ASTGen {
224210
static SourceLoc advanceLocBegin(const SourceLoc &Loc,
225211
const syntax::Syntax &Node);
226212

227-
/// Advance \p Loc to the last non-missing token of the \p Node or, if it
228-
/// doesn't contain any, the last non-missing token preceding it in the tree.
229-
/// \p Loc must be the leading trivia of the first token in the tree in which
230-
/// \p Node resides
231-
static SourceLoc advanceLocEnd(const SourceLoc &Loc,
232-
const syntax::Syntax &Node);
233-
234213
ValueDecl *lookupInScope(DeclName Name);
235214

236215
void addToScope(ValueDecl *D, bool diagnoseRedefinitions = true);
@@ -240,13 +219,9 @@ class ASTGen {
240219
TypeRepr *lookupType(syntax::TypeSyntax Type);
241220

242221
public:
243-
void addExpr(Expr *Expr, const SourceLoc Loc);
244-
bool hasExpr(const SourceLoc Loc) const;
245-
Expr *takeExpr(const SourceLoc Loc);
246-
247222
void addDeclAttributes(DeclAttributes attrs, const SourceLoc Loc);
248223
bool hasDeclAttributes(SourceLoc Loc) const;
249-
DeclAttributes takeDeclAttributes(const SourceLoc Loc);
224+
DeclAttributes getDeclAttributes(const SourceLoc Loc) const;
250225
};
251226
} // namespace swift
252227

trunk/include/swift/Parse/ParsedRawSyntaxNode.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class ParsedRawSyntaxNode {
5252
};
5353
struct DeferredLayoutNode {
5454
MutableArrayRef<ParsedRawSyntaxNode> Children;
55-
CharSourceRange Range;
5655
};
5756
struct DeferredTokenNode {
5857
const ParsedTriviaPiece *TriviaPieces;
@@ -73,9 +72,9 @@ class ParsedRawSyntaxNode {
7372
/// Primary used for capturing a deferred missing token.
7473
bool IsMissing = false;
7574

76-
ParsedRawSyntaxNode(syntax::SyntaxKind k, CharSourceRange r,
75+
ParsedRawSyntaxNode(syntax::SyntaxKind k,
7776
MutableArrayRef<ParsedRawSyntaxNode> deferredNodes)
78-
: DeferredLayout({deferredNodes, r}),
77+
: DeferredLayout({deferredNodes}),
7978
SynKind(uint16_t(k)), TokKind(uint16_t(tok::unknown)),
8079
DK(DataKind::DeferredLayout) {
8180
assert(getKind() == k && "Syntax kind with too large value!");
@@ -212,12 +211,14 @@ class ParsedRawSyntaxNode {
212211
return copy;
213212
}
214213

215-
CharSourceRange getDeferredRange() const {
214+
CharSourceRange getDeferredRange(bool includeTrivia) const {
216215
switch (DK) {
217216
case DataKind::DeferredLayout:
218-
return getDeferredLayoutRange();
217+
return getDeferredLayoutRange(includeTrivia);
219218
case DataKind::DeferredToken:
220-
return getDeferredTokenRangeWithTrivia();
219+
return includeTrivia
220+
? getDeferredTokenRangeWithTrivia()
221+
: getDeferredTokenRange();
221222
default:
222223
llvm_unreachable("node not deferred");
223224
}
@@ -242,9 +243,20 @@ class ParsedRawSyntaxNode {
242243

243244
// Deferred Layout Data ====================================================//
244245

245-
CharSourceRange getDeferredLayoutRange() const {
246+
CharSourceRange getDeferredLayoutRange(bool includeTrivia) const {
246247
assert(DK == DataKind::DeferredLayout);
247-
return DeferredLayout.Range;
248+
auto HasValidRange = [includeTrivia](const ParsedRawSyntaxNode &Child) {
249+
return !Child.isNull() && !Child.isMissing() &&
250+
Child.getDeferredRange(includeTrivia).isValid();
251+
};
252+
auto first = llvm::find_if(getDeferredChildren(), HasValidRange);
253+
if (first == getDeferredChildren().end())
254+
return CharSourceRange();
255+
auto last = llvm::find_if(llvm::reverse(getDeferredChildren()),
256+
HasValidRange);
257+
auto firstRange = first->getDeferredRange(includeTrivia);
258+
firstRange.widen(last->getDeferredRange(includeTrivia));
259+
return firstRange;
248260
}
249261
ArrayRef<ParsedRawSyntaxNode> getDeferredChildren() const {
250262
assert(DK == DataKind::DeferredLayout);

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ namespace swift {
3232
% if not node.is_syntax_collection():
3333
class Parsed${node.name};
3434
% end
35-
% if node.is_buildable():
36-
class Parsed${node.name}Builder;
37-
% end
3835
% end
3936

4037
% for node in SYNTAX_NODES + PARSEONLY_NODES:
@@ -82,10 +79,6 @@ public:
8279
static bool classof(const ParsedSyntax *S) {
8380
return kindof(S->getKind());
8481
}
85-
86-
% if node.is_buildable():
87-
using Builder = Parsed${node.name}Builder;
88-
% end
8982
};
9083

9184
% end

0 commit comments

Comments
 (0)