diff options
author | Anna Zaks <ganna@apple.com> | 2011-11-17 01:09:15 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-11-17 01:09:15 +0000 |
commit | 871606d8de7dd510da19354ad170a8da56948b81 (patch) | |
tree | 1f155a1590277d805a7698f617ee7acae02de58f /clang/lib/StaticAnalyzer/Core/CheckerContext.cpp | |
parent | 4f41440cf9fc3df3b7a8203a5f6c50d7cff17bc3 (diff) | |
download | bcm5719-llvm-871606d8de7dd510da19354ad170a8da56948b81.tar.gz bcm5719-llvm-871606d8de7dd510da19354ad170a8da56948b81.zip |
[analyzer] Put CheckerConext::getCalleeName out of line.
llvm-svn: 144870
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CheckerContext.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CheckerContext.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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(); +} |