[clang] [clang][analyzer] Model function addresses in constant initializers (PR #217608)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 08:47:37 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);
+ }
----------------
steakhal wrote:
Does this mean that it wouldn't work for references?
```c++
void fa(unsigned) {}
typedef void (&callback)(unsigned);
callback g = fa; // like here?
extern callback h;
```
https://github.com/llvm/llvm-project/pull/217608
More information about the cfe-commits
mailing list