[clang] [clang][analyzer] Model function addresses in constant initializers (PR #217608)

Radovan Božić via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 06:04:26 PDT 2026


================
@@ -326,6 +326,12 @@ loc::MemRegionVal SValBuilder::getCXXThis(const CXXRecordDecl *D,
 std::optional<SVal> SValBuilder::getConstantVal(const Expr *E) {
   E = E->IgnoreParens();
 
+  if (E->getType()->isFunctionPointerType()) {
+    if (const auto *FD =
+            dyn_cast_or_null<FunctionDecl>(E->getReferencedDeclOfCallee()))
+      return getFunctionPointer(FD);
+  }
----------------
bozicrHT wrote:

Good catch! I didn't considered that. It doesn't work for them right now. I will push the fix that handles them

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


More information about the cfe-commits mailing list