Commit Graph

20516 Commits

Author SHA1 Message Date
Slava Pestov
9516575d1c ASTDemangler: Simplify createBoundGenericType()
It's clever how it leverages the type checker to check generic arguments,
but calling checkGenericArguments() would have been simpler, and it doesn't
work for interface types anyway, so we would fail to demangle those.

Let's just cut this all out for now and build a BoundGenericType directly.
2019-01-25 21:44:02 -05:00
Slava Pestov
bbe6a56e22 ASTDemangler: Implement builtin types 2019-01-25 21:44:02 -05:00
Slava Pestov
2d21233378 ASTDemangler: Implement unresolved DependentMemberType
The debug mangling emits these when the type parameter only
conforms to one protocol having an associated type with this
name.
2019-01-25 21:44:02 -05:00
Ding Ye
ba2157bbee [Driver] Accept -serialize-diagnostics-path for the interpret mode. (#22113)
This patch allows `-serialize-diagnostics-path` for the interpret mode.
There is one file compiled in such mode, so it makes sense to support
this flag to specify an explicit output path for diagnostics emission.

Resolves: SR-9670
2019-01-25 17:20:32 -08:00
Doug Gregor
0181ea586d Merge pull request #22118 from DougGregor/remote-ast-private-types
[RemoteAST] Improve resolution of private types from metadata
2019-01-25 15:21:00 -08:00
Erik Eckstein
787c35f165 SILOptimizer: correctly handle unreachable blocks in StackNesting.
Instead of some special treatment of unreachable blocks, model unreachable as implicitly deallocating all alive stack locations at that point.
This requires an additional forward-dataflow pass. But it now correctly models the problem and fixes a compiler crash.

rdar://problem/47402694
2019-01-25 11:29:21 -08:00
Doug Gregor
61d14ed3d7 [Remote AST] Use anonymous context descriptor mangled names for private types.
When an anonymous context descriptor provides a mangled name, use that
mangled name to provide the private declaration name for its child context.
This allows us to resolve private type names correctly when the corresponding
anonymous context has its mangled name.

Fixes rdar://problem/38231646.
2019-01-25 10:20:25 -08:00
David Ungar
ff011bb35b Add a comment and also emit dependencies even if compilation error. 2019-01-24 22:39:28 -08:00
swift-ci
10e7611c2e Merge pull request #22107 from gottesmm/pr-bebfdb036c1c8906044e4a712fd37987f04c6c51 2019-01-24 20:53:36 -08:00
Michael Gottesman
6f767f8b34 [sil] Delete dead code.
Originally I wanted to try to use this code to optimize on ownership sil without
assuming verification passed (since the utility would check verification). In
the end, this was not useful.
2019-01-24 20:02:02 -08:00
David Ungar
91b3780e03 Fix include order to minimize diffs. 2019-01-24 19:06:09 -08:00
David Ungar
a7e9a4f8c7 Fixes 2019-01-24 18:47:50 -08:00
David Ungar
323c42c532 Fomat 2019-01-24 18:46:49 -08:00
David Ungar
26ef59f576 Fixes from master 2019-01-24 18:46:49 -08:00
David Ungar
7c48f151d4 Brought over latest default type request 2019-01-24 18:46:49 -08:00
David Ungar
b520b242dc Collapsed lots of changes. 2019-01-24 18:46:49 -08:00
Pavel Yaskevich
fe9376dd78 Merge pull request #22082 from xedin/move-weights-to-cs
[ConstraintSystem] Track AST depth information directly
2019-01-24 11:53:17 -08:00
Pavel Yaskevich
4342de969c Merge pull request #22084 from dingobye/sr9732
[Sema] Improve diagnostics for `variable_never_mutated` in case of for-each loop's binding.
2019-01-24 10:04:56 -08:00
Slava Pestov
9761e5ca42 Demangler: Print BuiltinFloatType as "FPIEEE<size>" not "Float<size>"
The type checker calls these types Builtin.FPIEEE<size>; the demangler
should too.

This is just cosmetic at the moment, but it was causing problems when
I added support for builtin types to the TypeDecoder.
2019-01-24 11:12:54 -05:00
Ding Ye
421d6b065a [Sema] Improve diagnostics for variable_never_mutated in case of for-each loop's binding.
The diagnostics for `variable_never_mutated` always suggests
changing `var` to `let`, which is misleading in case of
for-each loops where explicitly immutable context applies.
This patch adds some variety to the message to make it appropriate.

Resolves: SR-9732
2019-01-24 16:54:57 +11:00
Karoy Lorentey
df8eba480e [Sema] Add dedicated fix-it for NSObject.hashValue overrides
NSObject.hashValue used to be declared `@objc open` by historical accident. This has been corrected to `@nonobjc public` in Swift 5’s SDK overlays, to catch accidental overrides. (These never did work correctly, and shouldn’t have been allowed.)

Help migration by adding a dedicated error message for NSObject.hashValue overrides, with a nice fix-it.

rdar://problem/45674813
2019-01-23 19:43:04 -08:00
Pavel Yaskevich
49c40d92f6 [AST] Augment getDepthMap with information about parent expressions
Which is very useful for the solver because otherwise it'd have to
compute and store this information twice.
2019-01-23 18:21:07 -08:00
Rintaro Ishizaki
16d97b2c5c Merge pull request #22055 from rintaro/ide-contextinfo-suppliment
[SourceKit][IDE] Update for feedback
2019-01-23 17:24:20 -08:00
David Ungar
b7f3697387 Merge pull request #21907 from davidungar/A-defaultTypeReq-1-15-10
Use Request to getDefaultType & move cache to SourceFile.
2019-01-22 21:39:31 -08:00
David Ungar
66503ea978 Fix test typo & remove too-strict assertion. 2019-01-22 18:59:22 -08:00
swift-ci
f3773dacde Merge pull request #21869 from apple/marcrasi-const-evaluator-enums 2019-01-22 15:41:23 -08:00
Rintaro Ishizaki
32ebfa4761 [AST] Comment tweak 2019-01-22 15:38:13 -08:00
Harlan Haskins
015b159ec1 Merge pull request #21996 from harlanhaskins/la-z-boy
[ParseableInterfaces] Handle lazy vars
2019-01-22 15:26:37 -08:00
Saleem Abdulrasool
f2f4cb8b27 Merge pull request #21979 from compnerd/storage-class
Basic: set the correct storage class for the alignment
2019-01-22 12:16:25 -08:00
Harlan Haskins
f5fc6f0c57 [Lexer] Handle SwiftInterface files as well as SIL
Previously, the Lexer kept a single flag whether we’re lexing Swift or SIL. Instead, keep track if we’re parsing Swift, SIL, or a Swiftinterface file. .swiftinterface files allow $-prefixed identifiers anywhere.
2019-01-22 11:02:36 -08:00
Doug Gregor
0c88b88322 [ABI] Optionally emit mangled names into anonymous context metadata.
When -enable-anonymous-context-mangled-names is provided, emit mangled
names as part of the metadata of an anonymous context. This will allow
us to match textual mangled names to the metadata.

This is a backward-compatible ABI extension. Part of rdar://problem/38231646/.
2019-01-22 09:48:47 -08:00
swift-ci
feddd1d1c3 Merge pull request #22038 from gottesmm/pr-48a80b46d0806aa50603d26425b66bdb807aecc2 2019-01-22 02:44:09 -08:00
Michael Gottesman
f8f11fadf6 [ownership] Allow for callers of the linear lifetime checker to ask it to return leaking blocks instead of erroring.
A common pattern when working in ossa is the introduction of a copy for lifetime
reasons at a dominating point in a program with a single use that may not
post-dominate the use. This API gives a "tight lifetime" bound by returning the
blocks where the value needs to be destroyed to prevent leaks.

NOTE: I was not 100% sure if consume errors should still assert. It seems like a
double consume error would be user error, so an assert is probably fine.
2019-01-22 01:34:39 -08:00
Michael Gottesman
671033ac7d [ssa-updater] Allow a user to set the InsertedPHIs list after construction.
I need this API so that I can conditionally handle the inserted phis.
2019-01-22 01:29:45 -08:00
David Ungar
ec1797659e Cosmetics. 2019-01-20 23:38:47 -08:00
David Ungar
e7882170a7 Use array for the cache. 2019-01-20 23:30:03 -08:00
David Ungar
babbfe0288 Another stray \n. 2019-01-20 23:29:17 -08:00
David Ungar
179166c623 Since cache is keyed by SourceFile, only need to check if dependency is missing. 2019-01-20 23:01:36 -08:00
David Ungar
fe999d9a47 Format. 2019-01-20 22:47:40 -08:00
David Ungar
4ca97abaff Key cache by SourceFile. 2019-01-20 22:46:47 -08:00
David Ungar
ce17240781 Don’t output newline for simple_display of DeclContext. And clean up simple_display. 2019-01-20 22:46:13 -08:00
David Ungar
f1d74fe7ef Record dependency for cached results. 2019-01-20 21:58:26 -08:00
David Ungar
3573eb4f7c Don’t print enclosing contexts for simple_display. 2019-01-20 18:54:58 -08:00
David Ungar
5fce1a2381 Removed HAS_TRIVIAL_DISPLAY(const char*) 2019-01-20 18:42:42 -08:00
David Ungar
5827ffae45 Format 2019-01-20 16:34:48 -08:00
David Ungar
51bb354328 Move cache to ASTContext 2019-01-20 16:34:18 -08:00
David Ungar
b3d4ca6ee0 FIx SFINAE 2019-01-20 14:11:46 -08:00
David Ungar
4dbf4c323f Bug fix. 2019-01-19 22:02:59 -08:00
David Ungar
06356e64c9 Fixes. 2019-01-19 17:03:54 -08:00
David Ungar
15c5942077 Minor improvement 2019-01-18 17:09:16 -08:00