[opt-remark] Add support for simple object projections.

This ensures that we are able to properly look through struct_extract,
tuple_extract in cases where we have an aggregate with multiple non-trivial
subtypes (implying it is not-rc identical with those sub-types).

The end result is that we now emit good diagnostics for things like this:

```
func returnStructWithOwnerOwner(x: StructWithOwner) -> Klass {
    return x.owner // expected-remark {{retain}}
                   // expected-note @-7:33 {{of 'x.owner'}}
}
```
This commit is contained in:
Michael Gottesman
2020-07-26 16:25:26 -07:00
parent 0c7894f0d4
commit 0bd6a58fae
4 changed files with 409 additions and 98 deletions

View File

@@ -247,7 +247,8 @@ public:
Projection &operator=(Projection &&P) = default;
bool isValid() const { return Value.isValid(); }
bool isValid() const { return bool(*this); }
operator bool() const { return Value.isValid(); }
/// Convenience method for getting the underlying index. Assumes that this
/// projection is valid. Otherwise it asserts.