[PATCH] D82940: [ASTReader][ASTWriter][PCH][Modules] Fix (de)serialization of SwitchCases

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 06:28:06 PDT 2020


aaron.ballman added a comment.

In D82940#2125183 <https://reviews.llvm.org/D82940#2125183>, @riccibruno wrote:

> > I'm not certain I understand, but I'm removing my LG while we figure it out. Can you expound a bit further?
>
> Take a look at the AST dump of a small modification of the reduced test case which doesn't trigger the assertion:
>
>   void should_not_crash_with_switch_in_lambda() {
>     switch (1)
>     default:;
>     auto f = [] {
>       switch (1)
>       default:;
>     };
>   }
>
>
> Before the serialization of `LambdaExpr` for the `LambdaExpr *E`, we have `E->getBody() == E->getCallOperator()->getBody()`.
>  After serialization this is not true anymore because we are writing and reading the body directly when visiting the `LambdaExpr`
>  (the captures have the same problem).


Ah, thank you for the explanation! That does seem like an issue, good catch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82940/new/

https://reviews.llvm.org/D82940





More information about the cfe-commits mailing list