Commit Graph

7 Commits

Author SHA1 Message Date
Andrew Trick
c4abccb405 Merge pull request #34742 from atrick/fix-unchecked-ownership
Specify the unchecked_ownership_conversion instruction
2020-11-16 21:13:11 -08:00
Meghana Gupta
91b5c4917f Allow a borrowed address to be passed as in_guaranteed arg in partial_apply [on_stack] only (#34736) 2020-11-16 09:59:14 -08:00
Andrew Trick
976be60e01 Don't use report_fatal_error in the LoadBorrowImmutabilityChecker.
That prevents the SILVerifier from printing the context, making it
hard to quickly produce test cases from logs.

Instead, just return the failure status to the SILVerifier so it can
do its diagnostic thing.

An assert or llvm_unreachable would also be fine in addition to the
normal SILVerifier diagnostics, but I don't think that's needed here.
2020-11-13 16:34:42 -08:00
Meghana Gupta
ce218b3f0a Fix LoadBorrowImmutabilityChecker for partial applies (#34658) 2020-11-11 21:34:52 -08:00
Andrew Trick
0f1beedfb7 Reenable load-borrow checker. 2020-10-21 15:02:08 -07:00
Andrew Trick
8e3fb44f2d Rewrite LoadBorrowImmutabilityChecker using AccessPath.
The verification will now be as complete as it can be within the
capability of our SIL utilities. It is much more aggressive with
respect to boxes, references, and pointers. It's more efficient in
that it only considers "overlapping" uses.

It is also now wholly consistent with the utilities that it uses, so
can be reenabled.

We could probably go even further and remove the switch statement
entirely, relying on AccessPath to recognize any operations that
propagate addresses, boxes, or pointers. But I didn't want to
potentially weaken enforcement without more careful consideration.
2020-10-21 15:02:08 -07:00
Andrew Trick
4f05d8a857 LoadBorrowImmutabilityChecker renaming.
Limit names to a straightforward and unambiguous statement of
purpose. They should not pose additional questions which can only be
answered by reading the code. Nuanced meaning belongs in descriptions
and code comments.

These are all examples that legitimately made reading the code very
difficult for me:

- LoadBorrowInvalidationChecker: what does "invalidation" mean in this
  context? How does that extend the meaning of "checker"? How can
  something ever pass a checker and not be invalid?

- constructValuesForKey outside of an ADT does not state purpose at all.

- wellBehavedWriteAccumulator: Raises questions about what writes are
  included and the broader semantics of the parent function. It turns
  out that well-behavedness is handled by the function's return value
  and has nothing to do with the accumulator.
2020-10-21 13:09:40 -07:00