[clang] Fix crash with modules and constexpr destructor (PR #69076)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 18:03:43 PST 2023


ChuanqiXu9 wrote:

> I finally had time to debug this: The reason for modules being involved here is because the serialization code calls `ParmVarDecl::getDefaultArg()` which strips the outermost `FullExpr`, such as `ExprWithCleanups`. A potential fix is in #76473 though I'm not really convinced by this asymmetry between `getInit()` but calling `setDefaultArg()`. However, removing the handling of `FullExpr` in `setDefaultArg()` causes a total 29 test failures, so that's not an (easy) option...
> 
> Personally, I would argue that adding `FullExpressionRAII` makes the code more robust against the absence of `ExprWithCleanups` so that's maybe a good thing to have regardless of fixing the serialization code.

Thanks for looking into this. Good enough for me. Yeah the asymmetry between `getInit()` but calling `setDefaultArg()` is a concerning. Also it may be not easy to understand and fix the underlying problem (why getDefaultArg() will strip the outmost `FullExpr`) **properly**.

So personally I am fine with the current workaround with a `FIXME`. Let's wait for the opinion from @cor3ntin and @shafik 

https://github.com/llvm/llvm-project/pull/69076


More information about the cfe-commits mailing list