Commit Graph

5160 Commits

Author SHA1 Message Date
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Slava Pestov
62b650af83 AST: Fix excessive deserialization in GenericSignatureBuilder
When we're looking up all associated types with the same name in order
to find the right archetype anchor, skip extension members to avoid
circular deserialization.

Discovered while investigating <rdar://problem/30248571>.
2017-02-15 17:01:44 -08:00
Slava Pestov
41eba98902 Gardening: Fix some unused variable warnings in no-assert builds 2017-02-15 12:57:35 -08:00
Argyrios Kyrtzidis
c309fb2620 Merge pull request #7477 from akyrtzi/fsystem-search-path-option2
Add '-Fsystem' framework search option to indicate path for frameworks that should be treated as 'system'
2017-02-15 12:04:36 -08:00
Slava Pestov
c2d07bc210 AST: Cache the result of ClassDecl::checkObjCAncestry() 2017-02-14 22:35:27 -08:00
Slava Pestov
13d6b183c0 Merge pull request #7370 from llvm-beanz/simplify-add_swift_library
[CMake] Simplify add_swift_library
2017-02-14 19:16:59 -08:00
Argyrios Kyrtzidis
ca906d1e99 Add '-Fsystem' framework search option to indicate path for frameworks that should be treated as 'system'
This has the effect of propagating the search path to the clang importer as '-iframework'.
It doesn't affect whether a swift module is treated as system or not, this can be done as follow-up enhancement.
2017-02-14 16:13:25 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
Xi Ge
055da1fbfb [SourceKit] Teach name translation request to translate Swift names to ObjC ones (by using PrintAsObjC). (#7449) 2017-02-14 14:25:52 -08:00
practicalswift
8af31961b2 Merge pull request #7464 from practicalswift/gardening-20170214b
[gardening] Fix recently introduced typos
2017-02-14 21:10:52 +01:00
swift-ci
619d2d19f3 Merge pull request #7462 from akyrtzi/index-invalid-crash 2017-02-14 11:09:30 -08:00
practicalswift
65b0219f7b [gardening] Fix typos 2017-02-14 20:04:08 +01:00
Argyrios Kyrtzidis
bf80cff4d0 [index] Fix assertion hit during USR generation, when encountering an erroneous computed var. 2017-02-14 10:19:04 -08:00
swift-ci
b1c2719a0a Merge pull request #7461 from swiftix/substitutions-fixes 2017-02-14 10:03:48 -08:00
Roman Levenstein
ccac2a5678 Handle archetypes inside Substitution::subst
With inlining of generics we run into cases, where a replacement can be an archetype with a class requirement or an archetype with a superclass.
2017-02-14 08:27:18 -08:00
Doug Gregor
5b7e2d35fe [AST] ArchetypeTypes are always created with a generic environment. 2017-02-13 15:59:19 -08:00
Doug Gregor
58f181a470 [Generic signature builder] Eliminate "concrete type in path" checks.
We no longer need the "concrete type in path" checks to correctly
order potential archetypes, and they prohibit us from making the
representative always the archetype anchor.
2017-02-13 13:59:17 -08:00
Doug Gregor
9118a0488c [Generic signature builder] Eliminate isBetterArchetypeAnchor.
It's just a wrapper around compareDependentTypes() that was only used
for assertions.
2017-02-13 13:03:14 -08:00
Doug Gregor
0df3adb7a3 [Generic signature builder] Align the representative with the archetype anchor.
Make the representative of an equivalence class also be the archetype
anchor, so we don't need to walk through the equivalence class each
time we need the archetype anchor.
2017-02-13 13:03:13 -08:00
Doug Gregor
189f8a7843 [Generic signature builder] Align isBetterArchetypeAnchor and compareDependentTypes.
The latter was also performing the concrete-type-in-path check; do
that within compareDependentTypes(); we don't want a different here.
2017-02-13 13:03:13 -08:00
Doug Gregor
e3479e25fc [Generic signature builder] Concrete constraints across equivalence classes.
When emitting a requirement for a same-type-to-concrete constraint,
use the known concrete source for just the first of the component
anchors. For the rest, we need to explicitly model the constraint lest
it get lost. Fixes rdar://problem/30478915.
2017-02-13 12:49:09 -08:00
Doug Gregor
f6915546a2 [Generic signature builder] Ordering of nested types doesn't matter.
... so don't treat typealias-bound nested types as special.
2017-02-13 12:48:54 -08:00
Jordan Rose
1c60910198 Revert "Merge pull request #6092 from swiftix/wip-generics-inlining-flag-4"
This reverts commit 1b3d29a163, reversing
changes made to b32424953e.

We're seeing a handful of issues from turning on inlining of generics,
so I'm reverting to unblock the bots.
2017-02-13 10:52:17 -08:00
practicalswift
3e40296cfa [gardening] Fix inconsistent headers 2017-02-13 15:21:52 +01:00
practicalswift
6daa23fa8e [gardening] Fix a vs an typos 2017-02-13 14:45:16 +01:00
Hugh Bellamy
cb3bdcc2a3 Merge pull request #7408 from hughbe/llvm-fallthrough
Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH
2017-02-13 17:39:59 +07:00
Slava Pestov
c5dfb5238a AST: Completely hide internal representation of SubstitutionMap
Make the addSubstitution() and addConformance() methods private,
and declare GenericEnvironment and GenericSignature as friends of
SubstitutionMap.

At some point in the future, we can switch to a more efficient
representation of SubstitutionMap, where instead of storing
multiple hashtables, we store arrays; the keys are pre-determined.
2017-02-12 01:42:36 -08:00
Slava Pestov
3cd7bb2571 AST: Tighten up some assertions 2017-02-12 01:42:35 -08:00
Slava Pestov
f1dcf5af1e AST: Write some more fake code for conformance lookup in signature
This just fixes the warning about 'Sig' being an unused
member of LookUpConformanceInSignature.
2017-02-12 00:51:27 -08:00
Slava Pestov
5296d02485 AST: More include-what-you-use gardening 2017-02-12 00:51:26 -08:00
Slava Pestov
ec4a95be21 AST: Witness stores SubstitutionList instead of SubstitutionMap
This simplifies serialization and removes some calls of
SubstitutionMap::addSubstitution() and addConformance().
2017-02-12 00:51:26 -08:00
Slava Pestov
e8bd2cb367 AST: Targeted fix to prevent 0059-sr3321.swift from regressing 2017-02-12 00:51:25 -08:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
Doug Gregor
b6d54431cb Merge pull request #7398 from huonw/gsb-cleanups
[Generic signature builder] Substitute requirements instead of threading a PA around.
2017-02-11 18:48:05 -08:00
Doug Gregor
aa42045d66 [AST] “Error” types aren’t really unchecked; deal with them explicitly. 2017-02-11 00:04:13 -08:00
Doug Gregor
416d935df6 [Generic signature builder] Use addSameTypeRequirementBetweenArchetypes consistently.
Rather than trying to set the representative directly when adding
implicit requirements, use addSameTypeRequirementBetweenArchetypes()
consistently.
2017-02-11 00:04:12 -08:00
Roman Levenstein
1b3d29a163 Merge pull request #6092 from swiftix/wip-generics-inlining-flag-4
Enable inlining of generics
2017-02-10 20:13:36 -08:00
Huon Wilson
923113d912 [Generic signature builder] switch (...), not chained if (... ==). 2017-02-10 18:59:11 -08:00
Huon Wilson
f1dba0e7e8 [Generic signature builder] Substitute requirements instead of threading a PA around.
This essentially undoes the implementation in 51da51dfc0, which
implicitly did a substitution of the Self type in a protocol's
requirement signature by threading around the replacement PA. This is
brittle because every part of the code needs to take and pass around the
argument. By preemptively substituting, the whole requirement is in the
right form from the time it enters `addRequirement`.

The infrastructure here also allows simplifying some code.
2017-02-10 18:58:56 -08:00
Huon Wilson
dd597cce74 [Generic signature builder] Use the builder's param array properly in getDependentType. 2017-02-10 18:56:36 -08:00
Huon Wilson
38dc70f4c0 [Generic signature builder] Include the parent in the name of a typealias PA. 2017-02-10 18:56:35 -08:00
Roman Levenstein
e4af4e1c42 Handle archetypes inside Substitution::subst
With inlining of generics we run into cases, where a replacement can be an archetype with a class requirement or an archetype with a superclass.
2017-02-10 18:07:30 -08:00
Doug Gregor
579af863c5 Rename ArchetypeBuilder -> GenericSignatureBuilder 2017-02-10 12:46:34 -08:00
Doug Gregor
c6cbd13d31 [ArchetypeBuilder] Eliminate expandGenericEnvironment().
Remove the pre-expansion of all of the archetypes in a generic
environment; they can be constructed lazily from interface types.

Note that this only concerns the construction of the archetypes
themselves. The archetype builder is still pre-expanding all
*potential* archetypes.

"Fixes" rdar://problem/30351514, in the sense that the eager code and
the assertion that was getting tripped up are being eliminated
completely.
2017-02-10 01:44:40 -08:00
Doug Gregor
5a031d8500 Merge pull request #6154 from DougGregor/generic-env-serialization
[Serialization] Serialize archetypes as generic environment + interface type
2017-02-10 01:30:54 -08:00
Doug Gregor
2307e15290 [Clang importer] Compute the requirement signature of imported protocols.
We can also avoid walking the members of said protocols in the
archetype builder and when looking for nested types, because of course
there are no associated types in imported Objective-C protocols.
2017-02-09 23:50:16 -08:00
swift-ci
1e3ebc4194 Merge pull request #7374 from DougGregor/archetype-builder-assertion-diags 2017-02-09 17:06:55 -08:00
Doug Gregor
3f0d14b6f7 [Archetype builder] Improve crash diagnostics for nondeterministic failure.
The assertion

  "Potential archetype mapping differs from representative!"

keeps popping up intermittently but has been frustratingly hard to
reproduce. When we do catch it (as CI seems to do often "enough"),
dump all of the relevant information to aid in debugging.
2017-02-09 16:22:34 -08:00
swift-ci
41a0f6dbbd Merge pull request #7364 from DougGregor/structural-same-type 2017-02-09 15:28:13 -08:00
Doug Gregor
b412961003 [AST] Maintain type sugar in TypeMatcher. 2017-02-09 15:03:34 -08:00