From: Anna Zaks Date: Thu, 17 Nov 2011 01:09:15 +0000 (+0000) Subject: [analyzer] Put CheckerConext::getCalleeName out of line. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8687397a0f5e4c31632959d907f9d9b38d793b1c;p=clang [analyzer] Put CheckerConext::getCalleeName out of line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144870 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index d5eb95193e..181ff5d475 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -143,19 +143,7 @@ public: } /// \brief Get the name of the called function (path-sensitive). - StringRef 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(); - } + StringRef getCalleeName(const CallExpr *CE); private: ExplodedNode *addTransitionImpl(const ProgramState *State, diff --git a/lib/StaticAnalyzer/Core/CMakeLists.txt b/lib/StaticAnalyzer/Core/CMakeLists.txt index a2c351120e..391a781ab0 100644 --- a/lib/StaticAnalyzer/Core/CMakeLists.txt +++ b/lib/StaticAnalyzer/Core/CMakeLists.txt @@ -11,6 +11,7 @@ add_clang_library(clangStaticAnalyzerCore BugReporter.cpp BugReporterVisitors.cpp Checker.cpp + CheckerContext.cpp CheckerHelpers.cpp CheckerManager.cpp CheckerRegistry.cpp 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(); +}