Commit Graph

15976 Commits

Author SHA1 Message Date
Huon Wilson 0e337acae0 Revert "[AST] Ensure requirements are correctly identified as conditional." 2018-03-14 08:12:37 +11:00
Doug Gregor 19cdbda609 Merge pull request #15199 from DougGregor/gsb-same-type-without-potential-archetypes
[GSB] Eliminate potential archetypes from the same-type constraint representation
2018-03-13 13:54:35 -07:00
Rintaro Ishizaki 54b28b6cb6 Merge pull request #15152 from omochi/lex-remove-fields
[Parse] Remove unnecessary Lexer fields
2018-03-13 12:19:36 +09:00
Huon Wilson a5268f8d19 Merge pull request #15189 from huonw/one-unnamed-owned-argument
[AST] ParenType needs enough bits to store ValueOwnership::Owned.
2018-03-13 13:56:22 +11:00
Huon Wilson e7002b6413 [AST] ParenType needs enough bits to store ValueOwnership::Owned.
The truncation here meant func foo(_: __owned X) {} was the same as
foo(_: X), so @guaranteed when that's the default.

Fixes rdar://problem/38390524.
2018-03-13 10:18:40 +11:00
Vedant Kumar f9372fdb62 [DebugInfo] Improve stepping behavior for switch case stmts
Assign the location of a switch statement's subject expression to all of
its case statements.

This improves the debugger's stepping behavior in switch statements.
Stepping into a switch now goes directly to the first matching case
(possibly one with a `where` clause that may or may not match). It's
still possible to set breakpoints within `where` clauses.

rdar://35628672
2018-03-12 15:21:46 -07:00
Doug Gregor 31792ac3f7 [GSB] Eliminate potential archetypes from the same-type constraint representation.
Same-type constraints are one of the primary places where potential
archetypes are used explicitly in the GenericSignatureBuilder. Switch
the representation over to a dependent type (represented by a `Type`)
instead, furthering the demise of PotentialArchetype.
2018-03-12 10:33:39 -07:00
Doug Gregor ae2cdfc86f Merge pull request #15172 from DougGregor/gsb-weaken-potential-archetypes
[GSB] Reduce dependence on potential archetypes for rewrite tree
2018-03-12 10:32:03 -07:00
Jordan Rose c5dcf01aca Merge pull request #14814 from jrose-apple/dump-truck
Dump (some) filelists in the PrettyStackTrace
2018-03-12 09:13:20 -07:00
Doug Gregor d138575da2 Merge pull request #15170 from ikesyo/enum-class-uint8_t
[gardening][enum class] Replace `unsigned char` with `uint8_t` for consistency
2018-03-12 09:05:13 -07:00
omochimetaru 3c8057e13f [Parse] Remove unnecessary Lexer fields 2018-03-12 23:35:13 +09:00
omochimetaru 420291bbad [Syntax] isComment in trivia 2018-03-12 23:08:37 +09:00
Joe Groff 3fd2d2165e Merge pull request #15145 from jckarter/trimming-metadata
Trimming metadata
2018-03-12 06:55:59 -07:00
Rintaro Ishizaki c612da2805 [Lexer] Remove dead code (#15179)
Remove Lexer::getSubstring()
The last usage was deleted in d522cd4270.
2018-03-12 22:44:24 +09:00
Doug Gregor 4481a42c49 [GSB] Push potential archetype realization slightly deeper.
Same-type constraints are (still) described in terms of potential
archetypes, so push the "realization" operation for potential
archetypes down into the function that adds a same-type constraint
between type parameters.
2018-03-11 23:55:23 -07:00
Doug Gregor 0f7c822371 [GSB] Add same-type rewrite rules via dependent types.
GenericSignatureBuilder::addSameTypeRewriteRule() was described in
terms of an equivalence class and a potential archetype. Rework it in
terms of two dependent types (i.e., the anchors of their equivalence
classes), so we don't need to rely on the PotentialArchetype
mechanism.
2018-03-11 23:55:23 -07:00
Doug Gregor 35902bbee2 [GSB] Simplifying via the term rewriting system cannot fail.
Now that we no longer have DependentMemberTypes within the GSB that don't
have associated type declarations, we can no longer fail when
unpacking type into a RewritePath, so remove a bunch of optionals and
null Type checks that are now superfluous.
2018-03-11 23:55:22 -07:00
Andrew Trick 9703d56e03 [exclusivity] Remove dead access markers after optimization.
Generalized to handle scope markers which will become common with future
ownership and lifetime dependence markers.
2018-03-11 23:13:30 -07:00
Sho Ikeda 422136e1a2 [gardening][enum class] Replace unsigned char with uint8_t for consistency
Before the changes:

- `git grep -E "enum class .+ : uint8_t \{" | wc -l`: 90
- `git grep -E "enum class .+ : unsigned char \{" | wc -l`: 26
2018-03-12 13:57:36 +09:00
Huon Wilson be28f6830c Merge pull request #15094 from huonw/conditional-requirement-order
[AST] Ensure requirements are correctly identified as conditional.
2018-03-12 09:53:02 +11:00
Andrew Trick defc710f8b [exclusivity] Teach LetPropertiesOpt how to handle begin_access. 2018-03-11 14:20:39 -07:00
Joe Groff 37e3534b42 Runtime: Make generic parameter counts in context descriptors 16-bit.
64K generic parameters ought to be enough for anyone, right?
2018-03-11 11:04:41 -07:00
Joe Groff 98ee6a5d7d Runtime: Prefab metadata records for Any and AnyObject.
Metadata for these types gets demanded fairly frequently, and it's a decent code size savings not having to emit a runtime call to access them.
2018-03-10 10:15:42 -08:00
Joe Groff 57d6772d48 Runtime: Use type context descriptors to unique foreign metadata.
Now that every foreign type has a type context descriptor, we can use that for a uniquing key instead of a dedicated mangled string, saving some code size especially in code that makes heavy use of imported types. rdar://problem/37537241
2018-03-10 10:15:38 -08:00
Arnold Schwaighofer f01d84c4b9 Merge pull request #15132 from aschwaighofer/fix_linux_link_issue_attempt
Speculative fix for linux bot linker failure
2018-03-10 09:03:57 -08:00
omochimetaru 5e555868fe [Parse] Reduce branch by running lexTrivia always (#15137) 2018-03-10 21:26:54 +09:00
Jordan Rose 6243096b0b Dump input filelists in the PrettyStackTrace
This may help us reproduce a failing build when all we have is a build
log, and will become much more important in batch mode when we
/really/ need to know what ended up in what batch.

For now, this doesn't include /output/ filelists, because David's
about to mess with that code anyway to make things better around
supplementary outputs in batch mode. There is one weirdness there,
though, which is that ArgsToFrontendInputsConverter peeks at the
outputs to see whether we're doing single-threaded or multi-threaded
WMO.
2018-03-09 18:32:02 -08:00
Jordan Rose c860a6067f Reorganize ArgsToFrontendInputsConverter to be more functional-style
Per a conversation with DavidU.
2018-03-09 18:24:12 -08:00
Arnold Schwaighofer e106161d8f Speculative fix for linux bot linker failure 2018-03-09 17:55:39 -08:00
Doug Gregor cb76f8b445 Merge pull request #15113 from DougGregor/gsb-term-rewrite-compress
[GSB] Implement minimization of the term-rewriting system
2018-03-09 13:02:51 -08:00
Jordan Rose 41286bc676 Make JSON fix-it outputs be per-primary in batch mode. (#14995)
This means moving the output path into SupplementaryOutputPaths, and
using the same sort of diagnostic dispatching that serialized
diagnostics use. This is part of what's needed to run the migrator
in batch mode.
2018-03-09 11:58:54 -08:00
Doug Gregor 91aa964714 [GSB] Minimize the right-hand sides of rules in the term-rewriting system.
Introduce the first step of a minimization algorithm for the
term-rewriting system used to produce anchors of equivalence
classes. This step simplifies the right-hand sides of each rewrite
rule, so that each rewrite step goes to the minimal result.

This code is currently not enabled; it *can* be enabled by minimizing
before computing anchors, but it ends up pessimizing compile times to
do so.
2018-03-09 10:42:14 -08:00
swift-ci 5ae05e2398 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-09 09:58:01 -08:00
John McCall 9313aa04a1 Merge pull request #15071 from rjmccall/metadata-cache-entries
Rewrite MetadataCache to be a more natural extension of ConcurrentMap
2018-03-09 12:44:37 -05:00
Robert Widmann 72e4224dc9 Merge pull request #13655 from CodaFi/ace-attorney
[SE-0194] Implement deriving collections of enum cases
2018-03-09 12:43:13 -05:00
swift-ci d18d9d8455 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-09 09:38:10 -08:00
Arnold Schwaighofer 1e4f55de8d Merge pull request #15046 from aschwaighofer/without_actually_escaping_verification
Implement withoutActuallyEscaping verification
2018-03-09 09:34:06 -08:00
Robert Widmann dac06898e9 [SE-0194] Deriving Collections of Enum Cases
Implements the minimum specified by the SE-proposal.

* Add the CaseIterable protocol with AllCases associatedtype and
allCases requirement
* Automatic synthesis occurs for "simple" enums
    - Caveat: Availability attributes suppress synthesis.  This can be
              lifted in the future
    - Caveat: Conformance must be stated on the original type
              declaration (just like synthesizing Equatable/Hashable)
    - Caveat: Synthesis generates an [T].  A more efficient collection
              - possibly even a lazy one - should be put here.
2018-03-09 00:22:55 -05:00
Huon Wilson 88b9f2c94d [AST] Ensure requirements are correctly identified as conditional.
Previously, the following code would result in different sets of
conditional requirements:

  struct RedundancyOrderDependenceGood<T: P1, U> {}
  extension RedundancyOrderDependenceGood: P2 where U: P1, T == U {}

  struct RedundancyOrderDependenceBad<T, U: P1> {}
  extension RedundancyOrderDependenceBad: P2 where T: P1, T == U {}

The T: P1 requirement is redundant: it is implied from U: P1 and T == U,
but just checking it in the signature of the struct isn't sufficient,
the T == U requirement needs to be considered too. This uses a quadratic
algorithm to identify those cases. We don't think the quadratic-ness is
too bad: most cases have relatively few requirements.

Fixes rdar://problem/34944318.
2018-03-09 14:00:09 +11:00
swift-ci 36b254df94 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 01:58:15 -08:00
Sho Ikeda 74ba135008 Merge pull request #15040 from ikesyo/gardening-not-empty
[gardening] Use `!empty()` over `size() > 0`
2018-03-08 18:47:12 +09:00
John McCall f304c321f3 Rewrite MetadataCache to be a more natural extension of ConcurrentMap.
Change generic witness table instantiation to use a more lightweight
entry scheme that allocates the witness table as part of the entry.

In contrast, change generic metadata instantiation to use a more
straightforward allocation scheme where the metadata is a totally
independent allocation.

This is preparation for proper cyclic-dependency handling.
2018-03-08 02:29:20 -05:00
swift-ci 7cde895b95 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-07 21:18:13 -08:00
Rintaro Ishizaki 71d31907e8 Merge pull request #15043 from omochi/lex-init
[Parse] Refactor Lexer initialization
2018-03-08 14:04:02 +09:00
swift-ci 57e2fd3b52 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-07 18:38:16 -08:00
Huon Wilson b330c6078f Merge pull request #14948 from huonw/at-owned
Make __owned functional, maybe
2018-03-08 13:18:19 +11:00
omochimetaru 967a48cb77 [Parse] refactor Lexer initialization 2018-03-08 11:17:51 +09:00
Huon Wilson 38029bab2a [ABI] Store a ValueOwnership directly, not a manual encoding of it. 2018-03-08 12:36:37 +11:00
Huon Wilson e307e54098 [AST] Explicitly track things marked __owned. 2018-03-08 12:36:24 +11:00
Bob Wilson b5b4b7946c Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-07 16:59:30 -08:00