This is an archive of the discontinued LLVM Phabricator instance.

[clang][Serialization] Don't duplicate the body of LambdaExpr during deserialization
ClosedPublic

Authored by riccibruno on Jul 1 2020, 4:10 PM.

Details

Summary

05843dc6ab97a00cbde7aa4f08bf3692eb83109d changed the serialization of the body
of LambdaExpr to avoid a mutation in LambdaExpr::getBody and to avoid a missing
body in LambdaExpr::children.

Unfortunately this replaced one bug by another: we are now duplicating the body during
deserialization; that is after deserialization the identity:

E->getBody() == E->getCallOperator()->getBody() does not hold.

Fix that by instead lazily loading the body from the call operator when needed.

Diff Detail

Event Timeline

riccibruno created this revision.Jul 1 2020, 4:10 PM

I cherry picked this change and retried the case that was failing. This change addresses the issue I was seeing. Thanks.

martong accepted this revision.Jul 2 2020, 2:34 AM

I cherry picked this change and retried the case that was failing. This change addresses the issue I was seeing. Thanks.

Yes, I can confirm. Thanks!
Looks good to me!

This revision is now accepted and ready to land.Jul 2 2020, 2:34 AM
This revision was automatically updated to reflect the committed changes.