sgatev added inline comments.
================ Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:78 +/// and integers in the framework. +static const Expr *ignoreParenImpCastsExceptToBool(const Expr *E) { + const Expr *LastE = nullptr; ---------------- xazax.hun wrote: > li.zhe.hua wrote: > > sgatev wrote: > > > I don't recall why we need to ignore implicit casts here. Can't we ignore > > > parens and rely on the built-in transfer function, possibly adding > > > handling of some missing casts there? > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Analysis/FlowSensitive/Transfer.cpp#L192 > > If we only ignore parens, a test in the optional checker tests begins to > > fail, specifically `UncheckedOptionalAccessTest.ValueOrComparison`. The > > missing "cast" is an `ExprWithCleanups`. I didn't know how to deal with > > that, so this patch just working around the assert. > In general, I prefer to handle as much as possible with transfer functions > and skip as little as possible in the AST. We might skip `ExprWithCleanups` > nodes today, but we will need them tomorrow to properly model where certain > destructors are being invoked. We already have `skipExprWithCleanups` [1]. I wonder if it makes sense to replace that with a simple transfer function like the one for the `CK_NoOp` implicit cast. Would that solve the problem and remove the need for `ignoreParenImpCastsExceptToBool`? In the future we might replace that transfer function with a proper one, as Gábor suggested. [1] https://github.com/llvm/llvm-project/blob/main/clang/lib/Analysis/FlowSensitive/Transfer.cpp#L36 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://reviews.llvm.org/D124807 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits