aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/CheckerContext.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-12-01 05:57:37 +0000
committerAnna Zaks <ganna@apple.com>2011-12-01 05:57:37 +0000
commitb805c8ff133ef0c62df032fa711d6b13c5afd7f4 (patch)
tree79e10913c825cdf113d9267320edc29decaaf4aa /lib/StaticAnalyzer/Core/CheckerContext.cpp
parenta078ecf3484d62b01d9f8c01e0fecffd65c583e1 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/CheckerContext.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/CheckerContext.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp
index 75cb82a67c..5552a991d1 100644
--- a/lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ b/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();