[clang] [analyzer] Support determining origins in a conditional operator in WebKit checkers. (PR #91143)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Tue May 7 19:03:57 PDT 2024
================
@@ -27,12 +28,18 @@ tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj) {
E = tempExpr->getSubExpr();
continue;
}
+ if (auto *Expr = dyn_cast<ConditionalOperator>(E)) {
+ return tryToFindPtrOrigin(Expr->getTrueExpr(), StopAtFirstRefCountedObj,
+ callback) &&
+ tryToFindPtrOrigin(Expr->getFalseExpr(), StopAtFirstRefCountedObj,
----------------
rniwa wrote:
So the model is that we'd recurse for each expression. We'd stop at the first appearance of Ref/RefPtr if StopAtFirstRefCountedObj is set. Whether that semantics is correct or not depends on the context in which this function is called / used.
https://github.com/llvm/llvm-project/pull/91143
More information about the cfe-commits
mailing list