Skip to content

Commit 9ac8d10

Browse files
authored
---
yaml --- r: 349073 b: refs/heads/master c: 2e558f8 h: refs/heads/master i: 349071: 5445fdf
1 parent a59fa3d commit 9ac8d10

File tree

113 files changed

+2369
-1040
lines changed

Some content is hidden

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

113 files changed

+2369
-1040
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: 90fa96d8fada549fa358d49ec0ffbd43ca3fefc8
2+
refs/heads/master: 2e558f8c89367385fd4efa541ce152d717420b07
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/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/ASTContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ namespace swift {
109109
class TypeAliasDecl;
110110
class VarDecl;
111111
class UnifiedStatsReporter;
112+
class IndexSubset;
112113

113114
enum class KnownProtocolKind : uint8_t;
114115

trunk/include/swift/AST/ASTScope.h

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "swift/AST/ASTNode.h"
3232
#include "swift/AST/NameLookup.h" // for DeclVisibilityKind
33+
#include "swift/AST/SimpleRequest.h"
3334
#include "swift/Basic/Compiler.h"
3435
#include "swift/Basic/LLVM.h"
3536
#include "swift/Basic/NullablePtr.h"
@@ -88,6 +89,14 @@ struct AnnotatedInsertionPoint {
8889
ASTScopeImpl *insertionPoint;
8990
const char *explanation;
9091
};
92+
} // namespace ast_scope
93+
94+
namespace ast_scope {
95+
96+
void simple_display(llvm::raw_ostream &out, const ASTScopeImpl *);
97+
void simple_display(llvm::raw_ostream &out, const ScopeCreator *);
98+
99+
SourceLoc extractNearestSourceLoc(std::tuple<ASTScopeImpl *, ScopeCreator *>);
91100

92101
#pragma mark the root ASTScopeImpl class
93102

@@ -333,6 +342,11 @@ class ASTScopeImpl {
333342
public:
334343
/// expandScope me, sending deferred nodes to my descendants.
335344
/// Return the scope into which to place subsequent decls
345+
ASTScopeImpl *expandAndBeCurrentDetectingRecursion(ScopeCreator &);
346+
347+
/// Expand or reexpand the scope if unexpanded or if not current.
348+
/// There are several places in the compiler that mutate the AST after the
349+
/// fact, above and beyond adding Decls to the SourceFile.
336350
ASTScopeImpl *expandAndBeCurrent(ScopeCreator &);
337351

338352
unsigned getASTAncestorScopeCount() const { return astAncestorScopeCount; }
@@ -344,6 +358,12 @@ class ASTScopeImpl {
344358
void setWasExpanded() { wasExpanded = true; }
345359
virtual ASTScopeImpl *expandSpecifically(ScopeCreator &) = 0;
346360
virtual void beCurrent();
361+
virtual bool doesExpansionOnlyAddNewDeclsAtEnd() const;
362+
363+
public:
364+
bool isExpansionNeeded(const ScopeCreator &) const;
365+
366+
protected:
347367
bool isCurrent() const;
348368
virtual bool isCurrentIfWasExpanded() const;
349369

@@ -374,16 +394,7 @@ class ASTScopeImpl {
374394

375395
bool isATypeDeclScope() const;
376396

377-
/// There are several places in the compiler that mutate the AST after the
378-
/// fact, above and beyond adding Decls to the SourceFile. These are
379-
/// documented in: rdar://53018839, rdar://53027266, rdar://53027733,
380-
/// rdar://53028050
381-
/// Return true if did reexpand
382-
bool reexpandIfObsolete(ScopeCreator &);
383-
384397
private:
385-
void reexpand(ScopeCreator &);
386-
387398
virtual ScopeCreator &getScopeCreator();
388399

389400
#pragma mark - - creation queries
@@ -533,8 +544,8 @@ class ASTSourceFileScope final : public ASTScopeImpl {
533544
/// The number of \c Decls in the \c SourceFile that were already seen.
534545
/// Since parsing can be interleaved with type-checking, on every
535546
/// lookup, look at creating scopes for any \c Decls beyond this number.
536-
/// rdar://55562483 Unify with numberOfChildrenWhenLastExpanded
537-
int numberOfDeclsAlreadySeen = 0;
547+
/// TODO: Unify with numberOfChildrenWhenLastExpanded
548+
size_t numberOfDeclsAlreadySeen = 0;
538549

539550
ASTSourceFileScope(SourceFile *SF, ScopeCreator *scopeCreator);
540551

@@ -548,7 +559,6 @@ class ASTSourceFileScope final : public ASTScopeImpl {
548559
public:
549560
NullablePtr<DeclContext> getDeclContext() const override;
550561

551-
void addNewDeclsToScopeTree();
552562
void buildFullyExpandedTree();
553563
void
554564
buildEnoughOfTreeForTopLevelExpressionsButDontRequestGenericsOrExtendedNominals();
@@ -559,11 +569,15 @@ class ASTSourceFileScope final : public ASTScopeImpl {
559569

560570
protected:
561571
ASTScopeImpl *expandSpecifically(ScopeCreator &scopeCreator) override;
572+
bool isCurrentIfWasExpanded() const override;
573+
void beCurrent() override;
574+
bool doesExpansionOnlyAddNewDeclsAtEnd() const override;
562575

563576
ScopeCreator &getScopeCreator() override;
564577

565578
private:
566-
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
579+
AnnotatedInsertionPoint
580+
expandAScopeThatCreatesANewInsertionPoint(ScopeCreator &);
567581
};
568582

569583
class Portion {
@@ -1148,7 +1162,6 @@ class AttachedPropertyWrapperScope final : public ASTScopeImpl {
11481162
/// false positives, that that doesn't hurt anything. However, the result of
11491163
/// the conservative source range computation doesn't seem to be stable. So
11501164
/// keep the original here, and use it for source range queries.
1151-
/// rdar://55263708
11521165

11531166
const SourceRange sourceRangeWhenCreated;
11541167

@@ -1251,7 +1264,6 @@ class PatternEntryDeclScope final : public AbstractPatternEntryScope {
12511264
};
12521265

12531266
class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
1254-
// Should be able to remove this when rdar://53921703 is accomplished.
12551267
Expr *initAsWrittenWhenCreated;
12561268

12571269
public:

trunk/include/swift/AST/Decl.h

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,14 @@ class alignas(1 << DeclAlignInBits) Decl {
369369
IsPropertyWrapperBackingProperty : 1
370370
);
371371

372-
SWIFT_INLINE_BITFIELD(ParamDecl, VarDecl, 1+2+1+NumDefaultArgumentKindBits,
372+
SWIFT_INLINE_BITFIELD(ParamDecl, VarDecl, 1+2+NumDefaultArgumentKindBits,
373373
/// Whether we've computed the specifier yet.
374374
SpecifierComputed : 1,
375375

376376
/// The specifier associated with this parameter. This determines
377377
/// the storage semantics of the value e.g. mutability.
378378
Specifier : 2,
379379

380-
/// True if the type is implicitly specified in the source, but this has an
381-
/// apparently valid typeRepr. This is used in accessors, which look like:
382-
/// set (value) {
383-
/// but need to get the typeRepr from the property as a whole so Sema can
384-
/// resolve the type.
385-
IsTypeLocImplicit : 1,
386-
387380
/// Information about a symbolic default argument, like #file.
388381
defaultArgumentKind : NumDefaultArgumentKindBits
389382
);
@@ -4793,8 +4786,7 @@ class VarDecl : public AbstractStorageDecl {
47934786
bool issCaptureList, SourceLoc nameLoc, Identifier name,
47944787
DeclContext *dc, StorageIsMutable_t supportsMutation);
47954788

4796-
/// This is the type specified, including location information.
4797-
TypeLoc typeLoc;
4789+
TypeRepr *ParentRepr = nullptr;
47984790

47994791
Type typeInContext;
48004792

@@ -4814,8 +4806,10 @@ class VarDecl : public AbstractStorageDecl {
48144806
return hasName() ? getBaseName().getIdentifier().str() : "_";
48154807
}
48164808

4817-
TypeLoc &getTypeLoc() { return typeLoc; }
4818-
TypeLoc getTypeLoc() const { return typeLoc; }
4809+
/// Retrieve the TypeRepr corresponding to the parsed type of the parent
4810+
/// pattern, if it exists.
4811+
TypeRepr *getTypeRepr() const { return ParentRepr; }
4812+
void setTypeRepr(TypeRepr *repr) { ParentRepr = repr; }
48194813

48204814
bool hasType() const {
48214815
// We have a type if either the type has been computed already or if
@@ -5190,10 +5184,8 @@ class ParamDecl : public VarDecl {
51905184
Identifier argumentName, SourceLoc parameterNameLoc,
51915185
Identifier parameterName, DeclContext *dc);
51925186

5193-
/// Clone constructor, allocates a new ParamDecl identical to the first.
5194-
/// Intentionally not defined as a typical copy constructor to avoid
5195-
/// accidental copies.
5196-
ParamDecl(ParamDecl *PD, bool withTypes);
5187+
/// Create a new ParamDecl identical to the first except without the interface type.
5188+
static ParamDecl *cloneWithoutType(const ASTContext &Ctx, ParamDecl *PD);
51975189

51985190
/// Retrieve the argument (API) name for this function parameter.
51995191
Identifier getArgumentName() const { return ArgumentName; }
@@ -5210,10 +5202,7 @@ class ParamDecl : public VarDecl {
52105202
SourceLoc getParameterNameLoc() const { return ParameterNameLoc; }
52115203

52125204
SourceLoc getSpecifierLoc() const { return SpecifierLoc; }
5213-
5214-
bool isTypeLocImplicit() const { return Bits.ParamDecl.IsTypeLocImplicit; }
5215-
void setIsTypeLocImplicit(bool val) { Bits.ParamDecl.IsTypeLocImplicit = val; }
5216-
5205+
52175206
DefaultArgumentKind getDefaultArgumentKind() const {
52185207
return static_cast<DefaultArgumentKind>(Bits.ParamDecl.defaultArgumentKind);
52195208
}

trunk/include/swift/AST/DiagnosticsSIL.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ NOTE(constexpr_witness_call_with_no_conformance, none,
422422
NOTE(constexpr_unknown_control_flow_due_to_skip,none, "branch depends on "
423423
"non-constant value produced by an unevaluated instructions", ())
424424
NOTE(constexpr_returned_by_unevaluated_instruction,none,
425-
"return value of an unevaluated instruction is not a constant", ())
425+
"result of an unevaluated instruction is not a constant", ())
426426
NOTE(constexpr_mutated_by_unevaluated_instruction,none, "value mutable by an "
427427
"unevaluated instruction is not a constant", ())
428428

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ ERROR(cannot_convert_argument_value,none,
381381
(Type,Type))
382382

383383
NOTE(candidate_has_invalid_argument_at_position,none,
384-
"candidate expects value of type %0 for parameter #%1",
385-
(Type, unsigned))
384+
"candidate expects %select{|in-out }2value of type %0 for parameter #%1",
385+
(Type, unsigned, bool))
386386

387387
ERROR(cannot_convert_array_to_variadic,none,
388388
"cannot pass array of type %0 as variadic arguments of type %1",
@@ -4533,8 +4533,6 @@ ERROR(property_wrapper_wrong_initial_value_init, none,
45334533
(DeclName, Type, Type))
45344534
ERROR(property_wrapper_failable_init, none,
45354535
"%0 cannot be failable", (DeclName))
4536-
ERROR(property_wrapper_ambiguous_default_value_init, none,
4537-
"property wrapper type %0 has multiple default-value initializers", (Type))
45384536
ERROR(property_wrapper_type_requirement_not_accessible,none,
45394537
"%select{private|fileprivate|internal|public|open}0 %1 %2 cannot have "
45404538
"more restrictive access than its enclosing property wrapper type %3 "

0 commit comments

Comments
 (0)