[clang] Fix analyzer crash on 'StructuralValue' (PR #79764)
Andrey Ali Khan Bolshakov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 29 03:58:54 PST 2024
================
@@ -40,8 +40,12 @@ static const Expr *ignoreTransparentExprs(const Expr *E) {
switch (E->getStmtClass()) {
case Stmt::OpaqueValueExprClass:
- E = cast<OpaqueValueExpr>(E)->getSourceExpr();
- break;
+ if (const clang::Expr *SE = cast<OpaqueValueExpr>(E)->getSourceExpr()) {
+ E = SE;
+ break;
+ } else {
+ return E;
+ }
----------------
bolshakov-a wrote:
Thanks! `else` doesn't make sense, indeed.
But it should be noted that `SE` refers to the result of `->getSourceExpr()` and not to the result of `cast<OpaqueValueExpr>(E)`, hence its type is not a pointer to `OpaqueValueExpr`. Doesn't LLVM policy insist on the explicit type in such cases? Nevertheless, `clang::` qualification is redundant.
https://github.com/llvm/llvm-project/pull/79764
More information about the cfe-commits
mailing list