From 871606d8de7dd510da19354ad170a8da56948b81 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 17 Nov 2011 01:09:15 +0000 Subject: [PATCH] [analyzer] Put CheckerConext::getCalleeName out of line. llvm-svn: 144870 --- .../Core/PathSensitive/CheckerContext.h | 14 +-------- clang/lib/StaticAnalyzer/Core/CMakeLists.txt | 1 + .../StaticAnalyzer/Core/CheckerContext.cpp | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 clang/lib/StaticAnalyzer/Core/CheckerContext.cpp diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index d5eb95193ee3..181ff5d475d9 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/clang/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/clang/lib/StaticAnalyzer/Core/CMakeLists.txt b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt index a2c351120ec9..391a781ab09d 100644 --- a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt +++ b/clang/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/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp new file mode 100644 index 000000000000..f5bcfa98680e --- /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(); +}