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

Fangyi Zhou via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 22 02:41:39 PST 2025


================
@@ -151,72 +151,63 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) {
   return nonloc::SymbolVal(sym);
 }
 
-DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag,
-                                                   const Expr *Ex,
-                                                   const LocationContext *LCtx,
-                                                   unsigned Count) {
-  QualType T = Ex->getType();
-
-  if (T->isNullPtrType())
-    return makeZeroVal(T);
-
-  // Compute the type of the result. If the expression is not an R-value, the
-  // result should be a location.
-  QualType ExType = Ex->getType();
-  if (Ex->isGLValue())
-    T = LCtx->getAnalysisDeclContext()->getASTContext().getPointerType(ExType);
-
-  return conjureSymbolVal(SymbolTag, Ex, LCtx, T, Count);
-}
+// DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag,
----------------
fangyi-zhou wrote:

Note to self: This should probably be added back in some shape or form since it has some different behaviour when handling expressions with a provided type --- which means it's not entirely same to calling `conjureSymbolVal(SymbolTag, Ex, LCtx, Ex->getType(), Count)`. Probably need to revisit all callsites and check.

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


More information about the cfe-commits mailing list