Commit Graph

1938 Commits

Author SHA1 Message Date
Robert Widmann
5ec344b5b9 Define SWIFT_REQUEST
Begin refactoring the request evaluator by swapping SWIFT_TYPEID for
SWIFT_REQUEST.  Introduce the Zone of the request as a formal parameter
to the macro, then re-expand the request macro to get the type info
back.

SWIFT_REQUEST will eventually grow to encompass more information about
requests as we seek to reduce the boilerplate involved in their
definitions.
2019-08-27 17:38:14 -07:00
swift-ci
bb83c392ff Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-26 18:43:54 -07:00
David Ungar
5e14ed3f7d Merge pull request #26859 from davidungar/A-8-15-astscope-off
[NameLookup ASTScopes] Still off-by-default, but much closer to turning on
2019-08-26 18:32:30 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
swift-ci
abb9f9b8ab Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-26 11:05:16 -07:00
Doug Gregor
a23a4353cb [Type checker] Requestify the formation of an abstract generic signature
Introduce a request to form an abstract generic signature given a
base signature, additional generic parameters, and additional
requirements. It is meant to provide a caching layer in front of the
generic signature builder.

Switch one direct client of the generic signature builder over to this
mechanism, the formation of a generic signature for an existential
type.
2019-08-26 09:54:19 -07:00
swift-ci
fbe8e56e8b Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-24 10:03:05 -07:00
Brent Royal-Gordon
cac979ac09 Merge pull request #25977 from roop/sr11037_fixit_platform_condition_kind
[Parser][QoI] Offer fixit for changing the platform condition kind
2019-08-24 09:46:55 -07:00
swift-ci
86e95c23aa Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-23 17:43:50 -07:00
Brent Royal-Gordon
a5955fc682 [NFC] Extract helper from moveFileIfDifferent()
This separates the “do these two files have the same contents?” logic from the “move or delete” logic in `moveFileIfDifferent()`, creating a useful helper function. It also ties the special-case behavior for the `destination` parameter to a flag, since we have a use where we won’t want that.
2019-08-22 19:37:53 -07:00
Roopesh Chander
b75711c2d2 Make a .def file for PlatformConditionKind 2019-08-21 19:52:00 +00:00
Roopesh Chander
34fec7f1d4 [Parser][QoI] Offer fixit for changing the platform condition kind
For example, for "#if os(simulator)", offer a fixit to change
"os" to "targetEnvironment", instead of offering to change "simulator".

Resolves SR-11037.
2019-08-21 19:51:47 +00:00
swift-ci
3869e829fa Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-20 14:43:57 -07:00
Doug Gregor
b4e80cfd90 [Constraint graph] Enable one-way constraints in function builders.
Enable one-way constraints by default for function builders, finishing
rdar://problem/50150793.
2019-08-19 22:49:15 -07:00
swift-ci
d28622d4ac Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-19 21:43:25 -07:00
Slava Pestov
94c5a35bf2 AST: Add some counters related to name lookup 2019-08-19 23:00:57 -04:00
swift-ci
7eddc0b537 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-14 16:03:49 -07:00
Doug Gregor
1afd0f7cf7 Merge pull request #26654 from DougGregor/cyclic-one-way-constraints
[Constraint graph] Collapse cycles in the one-way component graph.
2019-08-14 15:57:56 -07:00
Doug Gregor
73e5a64bd1 [Constraint graph] Collapse cycles in the one-way component graph.
When we encounter a cycle in the one-way component graph due to constraints
that (e.g.) tie together the outputs of two one-way constraints, collapse
the components along the cycle into a single connected component, because
all of those type variables must be solved together.
2019-08-14 13:51:24 -07:00
swift-ci
7245d76875 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-14 11:44:30 -07:00
adrian-prantl
7a62165e09 Merge pull request #26648 from adrian-prantl/rm-dwarfimporter
Move DWARFImporterDelegate into ClangImporter and remove DWARFImporter.
2019-08-14 11:31:05 -07:00
Adrian Prantl
c08a62764a Move DWARFImporterDelegate into ClangImporter and remove DWARFImporter.
This refactors DWARFImporter to become a part of ClangImporter, since
it needs access to many of its implementation details anyway. The
DWARFImporterDelegate is just another mechanism for deserializing
Clang ASTs and once we have a Clang AST, the processing is effectively
the same.
2019-08-14 10:28:50 -07:00
swift-ci
10dbe46226 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-14 09:24:31 -07:00
Doug Gregor
7697611c15 Merge pull request #25983 from DougGregor/one-way-constraints
[Constraint solver] Introduce one-way binding constraints.
2019-08-14 09:19:11 -07:00
swift-ci
d328e44ea8 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-14 08:04:26 -07:00
David Ungar
b02b4b00ef Cleanup and fixes, also 1st cut at lazy. 2019-08-13 17:48:06 -07:00
Doug Gregor
be73a9d641 [Function builders] Add one-way constraints when applying function builders
When we transform each expression or statement in a function builder,
introduce a one-way constraint so that type information does not flow
backwards from the context into that statement or expression. This
more closely mimics the behavior of normal code, where type inference
is per-statement, flowing from top to bottom.

This also allows us to isolate different expressions and statements
within a closure that's passed into a function builder parameter,
reducing the search space and (hopefully) improving compile times for
large function builder closures.

For now, put this functionality behind the compiler flag
`-enable-function-builder-one-way-constraints` for testing purposes;
we still have both optimization and correctness work to do to turn
this on by default.
2019-08-13 12:38:46 -07:00
swift-ci
226cd140b9 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-12 14:44:07 -07:00
swift-ci
bfbbdc0105 Merge pull request #26621 from CodaFi/whitening 2019-08-12 14:43:52 -07:00
Robert Widmann
8553007191 [Gardening] Add a missing newline 2019-08-12 14:01:04 -07:00
swift-ci
380670fd01 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-09 17:44:26 -07:00
Slava Pestov
9dd835c71b Sema: Replace the finalizeDecl() mechanism with ClassDecl::getEmittedMembers()
The only thing remaining in finalizeDecl() is synthesis of
certain class members. Let's turn that into a request.
2019-08-09 19:08:47 -04:00
swift-ci
6bca134a93 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-09 16:04:24 -07:00
Harlan Haskins
7f07db5466 Merge pull request #26481 from owenv/print_diag_names
Add -debug-diagnostic-names frontend flag
2019-08-09 15:44:26 -07:00
Brent Royal-Gordon
fb20b503ba Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/ClangImporter/ClangImporter.cpp
#	test/IRGen/builtins.swift
#	test/IRGen/enum.sil
#	tools/driver/autolink_extract_main.cpp
#	utils/build-presets.ini
2019-08-08 17:07:59 -07:00
Michael Munday
b12e954dda Merge pull request #26449 from linux-on-ibm-z/s390x-enum-bit-packing-fix
IRGen: fix enum bit packing on big-endian platforms.
2019-08-07 21:22:34 +01:00
Michael Munday
bb2740e540 IRGen: fix enum bit packing on big-endian platforms.
This change modifies spare bit masks so that they are arranged in
the byte order of the target platform. It also modifies and
consolidates the code that gathers and scatters bits into enum
values.

All enum-related validation tests are now passing on IBM Z (s390x)
which is a big-endian platform.
2019-08-07 03:54:16 -04:00
David Ungar
09342dfa47 Add frontend flag -warn-if-astscope-lookup w/ test 2019-08-06 23:17:49 -07:00
Owen Voorhees
e7a1a1cc3d Add -debug-diagnostic-names frontend flag
This flag adds diagnostic names to the end of their messages, e.g. 'error: cannot convert value of type '[Any]' to specified type '[Int]' [cannot_convert_initializer_value]'. It's intended to be used for debugging purposes when working on the compiler.
2019-08-05 18:54:21 -07:00
Michael Gottesman
9c58e4b0a3 [patternmatch] Add InstructionOperand_match to support for matching against instructions with misc number of operands.
NOTE:

1. To test this I changed UnaryOp_match to use this under the hood.

2. These types of m_##ID##Inst matchers now will only accept compound types and
I added a static assert to verify that this mistake doesn't happen. We
previously had matchers that would take an int or the like to match tuple
extract patterns. I converted those to use TupleExtractOperation that also
properly handles destructures.
2019-08-05 17:26:02 -07:00
Jordan Rose
87b7ee1bc0 Tweak Swift-in-OS check to account for linker limitations
The backwards-deployment install name trickery we're using doesn't
handle "patch" components in version numbers, so we still need to
provide an rpath even when deploying to macOS 10.14.4.
2019-08-02 13:33:36 -07:00
Graydon Hoare
c2556ebf7d <rdar://43616773> Add swift::tripleHasSwiftInTheOS helper. 2019-08-02 13:27:02 -07:00
Jordan Rose
844ae38722 Remove some Swift STLExtras that LLVM now provides (#26443)
No functionality change.
2019-07-31 18:34:52 -07:00
Varun Gandhi
4808699750 Add comment pointing to module trace documentation. 2019-07-31 09:51:33 -07:00
JF Bastien
31e6a989f5 [NFC] Don't use LLVM_ALIGNAS (#26411)
It's not useful anymore, and I'm about to remove it in upstream.
2019-07-30 13:14:02 -07:00
Joe Groff
fa4dd15612 Sema: Correct composition of property wrappers.
Fixes rdar://problem/53407949 | SR-11138. Previously, we'd only look at the outermost property wrapper to decide whether the wrapped property's getter and setter were `mutating` (or exist at all). In reality, this requires considering the semantics of the composed accesses of each wrapper layer's
`wrappedValue` property. Fixing this systematically addresses a number of issues:

- As SR-11138 reported, composing a nonmutating-get-set wrapper ought to produce a composed wrapper
  that's nonmutating.

- We would previously allow a property wrapper with a mutating getter to be nested inside one with
  only a getter, even though the resulting implementation was unsound (because there's no mutable
  context for the inner wrapper to execute its get on.)

- Similarly, we would construct unsound setters in cases where the setter can't exist, such as when
  the nested wrapper isn't settable but the outer wrapper is.
2019-07-26 16:09:54 -07:00
Slava Pestov
ac9a3bf34a Sema: Add counters for synthesized accessors 2019-07-23 16:13:28 -04:00
Xi Ge
77ba3a21b4 IDE+Evaluator: refactor the implementation of two type checker utilities to evaluator requests. NFC
IDE functionality needs some internal type checking logics, e.g. checking
whether an extension is applicable to a concrete type. We used to directly
expose an header from sema called IDETypeChecking.h so that IDE functionalities
could invoke these APIs. The goal of the commit and following commits is to
expose evaluator requests instead of directly exposing function entry points from
sema so that we could later move IDETypeChecking.h to libIDE and implement these functions
by internally evaluating these requests.
2019-07-22 12:49:36 -07:00
Slava Pestov
56515ee871 Merge pull request #26119 from slavapestov/stored-properties-request
Re-implement NominalTypeDecl::getStoredProperties() using request evaluator
2019-07-17 09:12:47 -04:00
Xi Ge
1aaf5fcbe2 Merge pull request #26155 from nkcsgexi/request-cursor-info
Sourcekit+Evaluator: refactor cursor-info resolver to using the evaluator model. NFC
2019-07-16 16:26:27 -07:00