Commit Graph

1684 Commits

Author SHA1 Message Date
Michael Gottesman
3f6c4b96bb [gardening] Some small llvm style cleanups in DiagnoseStaticExclusivity. 2017-04-16 16:49:33 -07:00
swift-ci
272eb461ee Merge pull request #8798 from devincoughlin/static-access-enforcement-swap-suppression 2017-04-15 14:33:47 -07:00
Devin Coughlin
8d180f4bdc [SILDiagnostics] Add suppression for swap() to static access enforcement.
Add a SILLocation-based syntactic suppression for diagnostics of static
access conflicts on the arguments to the Standard Library's swap() free
function. We'll suppress for calls to this function until we have a safe
replacement.
2017-04-15 14:00:38 -07:00
swift-ci
8fc5a664bb Merge pull request #8797 from atrick/access 2017-04-15 13:32:16 -07:00
Andrew Trick
fff80ba77c [Exclusivity] Fix Definite Initialization for Diagnostics.
Handle mutating methods in initializers properly.

This only affects --enforce-exclusivity mode.
It will be unit tested by default soon.
2017-04-15 13:07:05 -07:00
swift-ci
d369c79eda Merge pull request #8795 from atrick/access 2017-04-15 12:46:52 -07:00
Devin Coughlin
8aa9b3af89 [SILDiagnostics] Move static enforcement enablement early return earlier.
This avoids computing the PostOrderAnalysis when this pass won't use it
because static checks are disabled.
2017-04-15 11:14:59 -07:00
Andrew Trick
c61151de7b [Exclusivity] Add CapturePromotion support for access markers.
This only affects -enforce-exclusivity mode.
2017-04-15 11:11:27 -07:00
practicalswift
b8ca098949 Merge pull request #8742 from practicalswift/gardening-20170413
[gardening] Use consistent headers. Remove redundant includes. Remove unused methods. Fix typos, etc.
2017-04-15 18:59:30 +02:00
Andrew Trick
095083e0e8 CopyForwarding: new optimization to remove copies into dead temporaries.
A SILGen peephole currently handles the common cases. However, that peephole
is incompatible with memory access enforcement.
2017-04-14 21:05:33 -07:00
Roman Levenstein
2c87f08e3f [sil-generic-specializer] Don’t build a new generic signature in case of a full specialization. NFC.
In case of a full specialization, the specialized function does not have a generic signature. Therefore there is no need to build it.
This speeds up the compilation by avoiding doing a useless work.
2017-04-14 19:45:04 -07:00
Roman Levenstein
998748e964 [sil-generic-specializer] Print more debug info when asserting 2017-04-14 19:42:04 -07:00
swift-ci
37941d769d Merge pull request #8787 from atrick/access 2017-04-14 19:16:29 -07:00
Andrew Trick
915b319810 [AccessEnforce] must handle undef before diagnostics. 2017-04-14 18:28:37 -07:00
Doug Gregor
faa0401598 [GSB] Allow requirement inference for synthesized requirements. 2017-04-14 17:19:02 -07:00
Doug Gregor
9dde2d7527 [SIL generics utils] Drastically simplify remapRequirements().
remapRequirements() was doing a whole lot of substitution work by
itself that the GenericSignatureBuilder is already capable of
doing. Use the GSB's functionality instead.
2017-04-14 17:19:02 -07:00
Huon Wilson
754d74ab8f Merge pull request #8753 from huonw/open-public-class-methods
Only `open`, not `public`, classes need public symbols
2017-04-14 13:35:00 -07:00
practicalswift
6828ed9e1e [gardening] Use isa<T>(o) instead of dyn_cast<T>(o) when result is unused 2017-04-14 17:33:24 +02:00
practicalswift
734ed6834f [gardening] Use correct multi-line block comment 2017-04-14 17:33:24 +02:00
practicalswift
d8d1693814 [gardening] Remove unused variables 2017-04-14 17:33:24 +02:00
practicalswift
980391a237 [gardening] Remove redundant include 2017-04-14 17:33:24 +02:00
Slava Pestov
db58e02cb2 Sema: Hook up layout constraints to the solver
There were various problems with layout constraints either
being ignored or handled incorrectly. Now that I've exercised
this support with an upcoming patch, there are some fixes
here.

Also, introduce a new ExistentialLayout::getLayoutConstriant()
which returns a value for existentials which are class-constrained
but don't have a superclass or any class-constrained protocols;
an example would be AnyObject, or AnyObject & P for some
non-class protocol P.

NFC for now, since these layout-constrained existentials cannot
be constructed yet.
2017-04-13 21:17:05 -07:00
Michael Gottesman
3b32ee8972 Merge pull request #8702 from gottesmm/move_ome_past_no_return_folding
[semantic-sil] Move the ownership model eliminator past no return folding.
2017-04-13 19:15:54 -07:00
Michael Gottesman
67d23b8489 [semantic-sil] Update DIMemoryObjectInfo to recognize destroy_value where it recognizes strong_release.
rdar://31521023
2017-04-13 16:47:45 -07:00
Michael Gottesman
17a51193fc [gardening] Invert if condition to reduce indentation. 2017-04-13 16:44:34 -07:00
Michael Gottesman
84d089b858 [gardening] Reduce indentation level by inverting an if condition. 2017-04-13 16:44:34 -07:00
Michael Gottesman
c6f5d4a75e [gardening] Cleanup DIMemoryObjectInfo::DIMemoryObjectInfo. NFC. 2017-04-13 16:44:33 -07:00
Michael Gottesman
9a55421878 [semantic-sil] Rename another field Releases -> Destroys. 2017-04-13 16:44:33 -07:00
Michael Gottesman
d9218c738f [semantic-sil] Rename "Releases" -> "Destroys". 2017-04-13 16:44:33 -07:00
Michael Gottesman
79ac3c9e49 [gardening] Fix a doyxgen comment. NFC. 2017-04-13 16:44:33 -07:00
Michael Gottesman
a346da3e87 [gardening] Eliminate some else-if in favor of early returns. 2017-04-13 16:44:33 -07:00
Michael Gottesman
6adcc2969e [semantic-sil] Change DefiniteInitialization to use the DIMemoryUseCollectorOwnership header instead of the normal DIMemoryUseCollector.
This is necessary since other passes rely on DIMemoryUseCollector.h and I want
to update each one of them individually to minimize disruption.

rdar://31521023
2017-04-13 16:41:53 -07:00
Huon Wilson
b59f95418c [SIL] Extract ClassVisibility from SILFunction to SubclassScope in SILLinkage. 2017-04-13 14:17:29 -07:00
swift-ci
a55d6525fe Merge pull request #8734 from atrick/access 2017-04-13 00:18:00 -07:00
Andrew Trick
66d42287a6 AccessEnforcementSelector: add support for arguments.
I'm using source-level tests to help bootstrap the -Onone pipeline
with access markers enabled.
2017-04-12 17:33:17 -07:00
Roman Levenstein
01e0ffd6c7 [eager-specializer] Handle functions with don’t have return basic blocks
This situation often happens if a function invokes a NoReturn function like fatalError.

Resolves rdar://31566966
2017-04-12 09:18:18 -07:00
practicalswift
27eabd4fb5 Merge pull request #8498 from practicalswift/gardening-20170403
[gardening] Fix typos. Fix headers. Python cleanups.
2017-04-12 16:41:33 +02:00
practicalswift
7684e73388 Merge pull request #8706 from practicalswift/excess-logic
[gardening] Remove redundant logic
2017-04-12 09:51:49 +02:00
Doug Gregor
5dadfa8fac Merge pull request #8707 from DougGregor/gsb-delayed-reqs
[GSB] Basic infrastructure for delaying and reprocessing requirements
2017-04-11 23:28:27 -07:00
swift-ci
7e044743a8 Merge pull request #8716 from devincoughlin/exclusive-access-rehash-crasher 2017-04-11 19:43:49 -07:00
Devin Coughlin
7d271cb444 [SILDiagnostics] Fix an invalidation crash in DiagnoseStaticExclusivity.
Fix a crash when re-hashing the basic-block map would leave behind a dangling
mutable reference.

The irony that the language feature this pass implements would have caught this
issue statically is not lost on me.
2017-04-11 19:14:32 -07:00
Andrew Trick
b308daf311 [SILOpt] fix the ASAN issue in the new pass completely.
LLVM's ilist::erase is actually correct. It just implements a nonstandard remove
method that modifies it's iterator argument.

I forgot to add "continue" statements when fixing the iterator-invalidation problem.
2017-04-11 15:48:24 -07:00
Doug Gregor
10ebdcd50a [GSB] Broaden the Boolean result of "add a constraint" operations.
Rather than true (an error occurred) or false (the constraint was
resolved), introduce ConstraintResult to better model what
happened. NFC for now, but the intent here is to report unresolved
constraints through this mechanism.
2017-04-11 14:15:45 -07:00
practicalswift
5e255e07d7 [gardening] Remove redundant logic 2017-04-11 23:04:55 +02:00
Michael Gottesman
e7b8865696 [semantic-sil] Move the ownership model eliminator past no return folding.
rdar://31521023
2017-04-11 11:43:19 -07:00
Arnold Schwaighofer
601b1e6bd4 SILOptimizer: Add a zero cost for inlining const_string_literal instructions 2017-04-11 10:11:17 -07:00
Michael Gottesman
464b61fb36 [semantic-sil] Copy DIMemoryUseCollector.{cpp,h} => DIMemoryUseCollectorOwnership.{cpp,h} so I can update the passes that use this functionality one at a time. 2017-04-11 09:24:36 -07:00
swift-ci
6956926264 Merge pull request #8686 from rjmccall/access-enforcement-selection-pass 2017-04-11 00:49:29 -07:00
practicalswift
520469a61a [gardening] Fix a vs an typo 2017-04-11 09:37:55 +02:00
John McCall
b9676d2002 Add a SIL pass to select an access enforcement for allocated boxes.
Tests to come.
2017-04-11 03:10:51 -04:00