[analyzer] Put CheckerConext::getCalleeName out of line.

llvm-svn: 144870
This commit is contained in:
Anna Zaks 2011-11-17 01:09:15 +00:00
parent 4f41440cf9
commit 871606d8de
3 changed files with 33 additions and 13 deletions

View File

@ -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,

View File

@ -11,6 +11,7 @@ add_clang_library(clangStaticAnalyzerCore
BugReporter.cpp
BugReporterVisitors.cpp
Checker.cpp
CheckerContext.cpp
CheckerHelpers.cpp
CheckerManager.cpp
CheckerRegistry.cpp

View File

@ -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();
}