aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/CheckerContext.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-11-17 01:09:15 +0000
committerAnna Zaks <ganna@apple.com>2011-11-17 01:09:15 +0000
commit8687397a0f5e4c31632959d907f9d9b38d793b1c (patch)
tree86975103ea3d2c76493f44d5a190fb7b60d7ed07 /lib/StaticAnalyzer/Core/CheckerContext.cpp
parentf471487ff1e673531543576bc170898c2ab19f41 (diff)
[analyzer] Put CheckerConext::getCalleeName out of line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/CheckerContext.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/CheckerContext.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp
new file mode 100644
index 0000000000..f5bcfa9868
--- /dev/null
+++ b/lib/StaticAnalyzer/Core/CheckerContext.cpp
@@ -0,0 +1,31 @@
+//== CheckerContext.cpp - Context info for path-sensitive checkers-----------=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines CheckerContext that provides contextual info for
+// path-sensitive checkers.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+using namespace clang;
+using namespace ento;
+
+StringRef CheckerContext::getCalleeName(const CallExpr *CE) {
+ const ProgramState *State = getState();
+ const Expr *Callee = CE->getCallee();
+ SVal L = State->getSVal(Callee);
+
+ const FunctionDecl *funDecl = L.getAsFunctionDecl();
+ if (!funDecl)
+ return StringRef();
+ IdentifierInfo *funI = funDecl->getIdentifier();
+ if (!funI)
+ return StringRef();
+ return funI->getName();
+}