[PATCH] D83009: [clang][Serialization] Don't duplicate the body of LambdaExpr during deserialization

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 16:14:18 PDT 2020


riccibruno created this revision.
riccibruno added reviewers: vabridgers, martong, aaron.ballman.
riccibruno added a project: clang.
Herald added subscribers: cfe-commits, rnkovacs.

05843dc6ab97a00cbde7aa4f08bf3692eb83109d <https://reviews.llvm.org/rG05843dc6ab97a00cbde7aa4f08bf3692eb83109d> 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83009

Files:
  clang/include/clang/AST/ExprCXX.h
  clang/lib/AST/ExprCXX.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/AST/ast-dump-lambda-body-not-duplicated.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83009.274951.patch
Type: text/x-patch
Size: 6484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200701/a9f0c212/attachment-0001.bin>


More information about the cfe-commits mailing list