From b673c65cb2e98fb10fca106165a3df31d08be8b9 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 23 Apr 2015 16:14:19 +0000 Subject: Extend format specifier checking to include field function pointers in addition to variable function pointers. Addresses PR21082. llvm-svn: 235606 --- clang/lib/Sema/SemaChecking.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'clang/lib/Sema/SemaChecking.cpp') diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 05eaaec5792..fd91c77bf12 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -1289,11 +1289,14 @@ bool Sema::CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation lbrac, bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall, const FunctionProtoType *Proto) { - const VarDecl *V = dyn_cast(NDecl); - if (!V) + QualType Ty; + if (const auto *V = dyn_cast(NDecl)) + Ty = V->getType(); + else if (const auto *F = dyn_cast(NDecl)) + Ty = F->getType(); + else return false; - QualType Ty = V->getType(); if (!Ty->isBlockPointerType() && !Ty->isFunctionPointerType()) return false; -- cgit v1.2.3