From c6aa531a8f89d5b671aea57576f40b205784b530 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 1 Dec 2011 05:57:37 +0000 Subject: [analyzer] Refactor checkers to use helper function for getting callee Decl and name. We are getting name of the called function or it's declaration in a few checkers. Refactor them to use the helper function in the CheckerContext. llvm-svn: 145576 --- clang/lib/StaticAnalyzer/Core/CheckerContext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Core/CheckerContext.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp index 75cb82a67c4..5552a991d15 100644 --- a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp @@ -16,12 +16,15 @@ using namespace clang; using namespace ento; -StringRef CheckerContext::getCalleeName(const CallExpr *CE) const { +const FunctionDecl *CheckerContext::getCalleeDecl(const CallExpr *CE) const { const ProgramState *State = getState(); const Expr *Callee = CE->getCallee(); SVal L = State->getSVal(Callee); + return L.getAsFunctionDecl(); +} - const FunctionDecl *funDecl = L.getAsFunctionDecl(); +StringRef CheckerContext::getCalleeName(const CallExpr *CE) const { + const FunctionDecl *funDecl = getCalleeDecl(CE); if (!funDecl) return StringRef(); IdentifierInfo *funI = funDecl->getIdentifier(); -- cgit v1.2.3