From 871606d8de7dd510da19354ad170a8da56948b81 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 17 Nov 2011 01:09:15 +0000 Subject: [analyzer] Put CheckerConext::getCalleeName out of line. llvm-svn: 144870 --- clang/lib/StaticAnalyzer/Core/CheckerContext.cpp | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 clang/lib/StaticAnalyzer/Core/CheckerContext.cpp (limited to 'clang/lib/StaticAnalyzer/Core/CheckerContext.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp new file mode 100644 index 00000000000..f5bcfa98680 --- /dev/null +++ b/clang/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(); +} -- cgit v1.2.3