Index: clang/lib/Analysis/ThreadSafety.cpp =================================================================== --- clang/lib/Analysis/ThreadSafety.cpp +++ clang/lib/Analysis/ThreadSafety.cpp @@ -2063,10 +2063,22 @@ examineArguments(Exp->getDirectCallee(), Exp->arg_begin(), Exp->arg_end()); } - auto *D = dyn_cast_or_null(Exp->getCalleeDecl()); - if(!D || !D->hasAttrs()) + const auto *ND = dyn_cast_if_present(Exp->getCalleeDecl()); + if (!ND) return; - handleCall(Exp, D); + + // For function pointers, try to get the currently known + // value of the pointer. + if (const auto *VD = dyn_cast(ND)) { + if (const Expr *E = Analyzer->LocalVarMap.lookupExpr(ND, LVarCtx)) { + if (const auto *DRE = dyn_cast(E->IgnoreParenImpCasts())) + ND = DRE->getDecl(); + } + } + + if (!ND->hasAttrs()) + return; + handleCall(Exp, ND); } void BuildLockset::VisitCXXConstructExpr(const CXXConstructExpr *Exp) {