[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 07:48:29 PST 2025


================
@@ -151,10 +153,13 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) {
   return nonloc::SymbolVal(sym);
 }
 
-DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag,
-                                                   const Expr *Ex,
-                                                   const LocationContext *LCtx,
-                                                   unsigned Count) {
+/// When using this overload, the \p elemRef provided must be a \p CFGStmt.
+DefinedOrUnknownSVal
+SValBuilder::conjureSymbolVal(const void *SymbolTag,
+                              const CFGBlock::ConstCFGElementRef elemRef,
+                              const LocationContext *LCtx, unsigned Count) {
+  const Expr *Ex = cast<Expr>(elemRef->getAs<CFGStmt>()->getStmt());
----------------
isuckatcs wrote:

```suggestion
  const Expr *Ex = dyn_cast<Expr>(elemRef->getAs<CFGStmt>()->getStmt());
```

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


More information about the cfe-commits mailing list