diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index d5eb95193ee3d05d71c8ba3703a6fbcdc9da10df..181ff5d475d902fe863e90021c513346515c9446 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 a2c351120ec9614693e73d9de1bb535cafaa62ec..391a781ab09d62a82de4854502c555d090e51274 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 0000000000000000000000000000000000000000..f5bcfa98680ecab4de134dd16c2343161c714817 --- /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(); +}