Commit Graph

37537 Commits

Author SHA1 Message Date
Mark Lacey c3335e53e9 Merge pull request #15224 from rudkx/print-patterns-consistently
Change OptionalSomePattern to print in a manner consistent with other…
2018-03-13 21:38:32 -07:00
Joe Groff 1e549ecdb8 Merge pull request #15217 from jckarter/irgen-silfunction-local-reference
IRGen: Set CurSourceFile for SIL functions using the module's associa…
2018-03-13 16:45:53 -07:00
Mark Lacey b4e854e9c1 Change OptionalSomePattern to print in a manner consistent with other patterns. 2018-03-13 16:40:35 -07:00
Joe Groff c0629d2240 IRGen: Set CurSourceFile for SIL functions using the module's associated context.
SIL functions might be associated with decls from other source files whose symbols we can't necessarily locally link to. The module should be associated with the SourceFile that was compiled.
2018-03-13 14:20:52 -07:00
Huon Wilson 0e337acae0 Revert "[AST] Ensure requirements are correctly identified as conditional." 2018-03-14 08:12:37 +11:00
Doug Gregor a191b9e14e Merge pull request #15169 from ikesyo/using-over-typedef
[gardening][lib/Basic][C++11] Replace `typedef` with `using`
2018-03-13 13:56:43 -07:00
swift-ci ec13c07117 Merge pull request #15210 from adrian-prantl/cleanup-1 2018-03-13 13:56:24 -07: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
Slava Pestov 5795bdf94a Merge pull request #15200 from slavapestov/conditional-buffer-cleanup
IRGen: Clean up FIXME in emitConditionalConformancesBuffer()
2018-03-13 13:10:24 -07:00
Pavel Yaskevich 274c1097bb Merge pull request #15187 from xedin/rdar-37790062-followup
[SILGen] NFC: Add test-cases for rdar://problem/37790062
2018-03-13 12:15:14 -07:00
Adrian Prantl 2b1811ec90 Rename local variable (NFC) 2018-03-13 10:48:17 -07:00
Slava Pestov 10eb1785e5 IRGen: Clean up FIXME in emitConditionalConformancesBuffer() 2018-03-13 01:34:55 -07:00
swift-ci d06ba63d21 Merge pull request #15148 from compnerd/msvc-sdk 2018-03-12 22:27:51 -07:00
Sho Ikeda eaf33e0998 [gardening][lib/Basic] Replace typedef with using 2018-03-13 13:46:38 +09: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
Davide Italiano 04ea4cca6e Merge pull request #15126 from dcci/typereconstr-fixup-private
[IDE] Fix type reconstructions for PrivateDeclName.
2018-03-12 16:34:20 -07:00
Mark Lacey e0820449b3 Merge pull request #15188 from rudkx/remove-stray-binding
Remove stray method declaration.
2018-03-12 15:36:04 -07: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
swift-ci a0d9c2371a Merge pull request #15184 from adrian-prantl/38324861 2018-03-12 14:53:15 -07:00
Harlan aa1059c9a3 [Syntax] Parse WhileStmtSyntax nodes (#15186) 2018-03-12 17:50:07 -04:00
Mark Lacey 22f9b004ac Remove stray method declaration. 2018-03-12 14:31:20 -07:00
Pavel Yaskevich b95635ca13 [SILGen] NFC: Add test-cases for rdar://problem/37790062
Port multiple test-cases from `test/Constraints/closures.swift`
to SILGen to verify that closures are inferred as having `Void`
result type, and there is no function conversion thunk emitted
to convert from `() -> T` to `() -> Void` for literal closures.
2018-03-12 14:20:00 -07:00
Davide Italiano 74618cbe96 [IDE] Fix type reconstructions for PrivateDeclName.
Without this fix, the type reconstruction logic chokes on
demangled subtree of the kind:

kind=DeclContext
  kind=Function
    kind=Module, text="swift_ide_test"
    kind=PrivateDeclName
      kind=Identifier, text="_0830B395847924C73A6666B87EFD2ADF"
      kind=Identifier, text="patatino"

Fixes the compiler part of <rdar://problem/38248403>
2018-03-12 13:45:15 -07:00
Adrian Prantl 6663462c53 Debug Info: Fix the emission of vector types.
Thanks to an improved IR verifier upstream we found that support for
vector types has been incomplete.

<rdar://problem/38324861>
2018-03-12 12:25:22 -07:00
Pavel Yaskevich 94dbbd7974 Merge pull request #15134 from xedin/rdar-37790062-v3
[CSBindings] Try `Void` as a binding for `closure result` type variable
2018-03-12 11:40:10 -07:00
Saleem Abdulrasool 45979fa774 ClangImporter: expand -sdk appropriately on Windows
The MSVC environment does not have a `-isysroot` or `-sysroot`
equivalent.  Instead, manually expand the sysroot to the path as a
prefix to `/usr/include` and treat the path as a system include
directory.  This fixes a number of tests which use `-sdk` on Windows.
2018-03-12 11:06:00 -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 66bcc00a72 [Parse] getLineNumber before parsing the closure (#15178)
Previously, if the closure has nested trailing closure, it slows down
because of cache in SourceMgr.
2018-03-12 22:44:10 +09:00
swift-ci 1feaec3708 Merge pull request #15175 from gottesmm/pr-a06a9d884e5fe4a32754f5918f5e8f51abcc5b9c 2018-03-12 05:24:23 -07:00
swift-ci 7d16d131e7 Merge pull request #15091 from graydon/batch-mode-formation-minor-fixes 2018-03-12 04:40:02 -07:00
Michael Gottesman 5c0a875a79 [silgen] Change SwitchEnumBuilder to invalidate the insertion point unconditonally after emitting a block, rather than asserting so.
If we perform an exit and do not use a terminator, then we will still have a set
insertion point. By unconditionally unsetting it, we gain the property that we
want and are nice to the normal exit case.
2018-03-12 04:34:31 -07:00
Michael Gottesman 4c9ecf94eb Merge pull request #15121 from gottesmm/pr-034f7af60b0970968a7e21e1ba6d01ea7ee5a44d
[+0-all-args] Make SILGenBuilder::createUncheckedBitCast more correct.
2018-03-12 00:27:52 -07: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 9552692cd3 [GSB] Eliminate equivalence-class lookup from type canonicalization.
Make GenericSignatureBuilder::getCanonicalTypeParameter() independent of
equivalence classes. This is primarily cleanup, because all of these
equivalence-class resolution calls were actually dead from the point
where we changed the key for the rewrite-roots DenseMap over to
dependent types.
2018-03-11 23:55:23 -07:00
Doug Gregor 0eedacf183 [GSB] Use anchors for the keys in the mapping to rewrite tree roots.
Rather than keying the rewrite tree roots on equivalence classes,
which imply a mapping through potential archetypes, key on (canonical)
types that are currently the anchors of equivalence classes.
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
Michael Gottesman 8b1d38aba8 [+0-normal-args] When transforming, be sure to use SILGenBuilder APIs to ensure that cleanups are properly forwarded.
Caught by the ownership verifier when updating objc_bridging_peephole.swift for +0 args.
2018-03-11 23:49:51 -07:00
Michael Gottesman 9cc1fcc2b2 [+0-normal-args] Update some bridging code to use SILGenBuilder APIs so cleanups are on the cast result, not the cast operand.
Found with the ownership verifier when fixing objc_bridging_any.swift for +0 arguments.
2018-03-11 23:49:51 -07:00
Michael Gottesman 3823ff0958 [+0-all-args] Make SILGenBuilder::createUncheckedBitCast more correct.
The main change here is that we no longer forward ownership through
unchecked_bitwise_cast. The reason why is that unchecked_bitwise_cast creates a
new "reference count" identity to the optimizer. This is reflected in the SIL
ownership model by unchecked_bitwise_cast returning a value with unowned
ownership. We really do not want to traffic in such values, so we copy the value
after the cast to ensure that result is valid.

Found while updating SILGen tests for +0.

rdar://34222540
2018-03-11 23:49:51 -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
Andrew Trick 2dcb5c66cc [NFC] cleanup stripAddressAccess from previous checkin.
Remove the fake recursion.
2018-03-11 23:13:30 -07:00
Rintaro Ishizaki 1dc3e17f52 [Lexer] Performance improvement for Lexer::kindOfIdentifier (#15168)
Don't check SIL_KEYWORDs when we're not in SIL mode.
Lexer::kindOfIdentifier is super hot-path because many of
tokens in a swift source file are keywords or identifiers.
2018-03-12 15:03:58 +09: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