CheckerContext.cpp revision 8687397a0f5e4c31632959d907f9d9b38d793b1c
1//== CheckerContext.cpp - Context info for path-sensitive checkers-----------=// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines CheckerContext that provides contextual info for 11// path-sensitive checkers. 12// 13//===----------------------------------------------------------------------===// 14 15#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" 16using namespace clang; 17using namespace ento; 18 19StringRef CheckerContext::getCalleeName(const CallExpr *CE) { 20 const ProgramState *State = getState(); 21 const Expr *Callee = CE->getCallee(); 22 SVal L = State->getSVal(Callee); 23 24 const FunctionDecl *funDecl = L.getAsFunctionDecl(); 25 if (!funDecl) 26 return StringRef(); 27 IdentifierInfo *funI = funDecl->getIdentifier(); 28 if (!funI) 29 return StringRef(); 30 return funI->getName(); 31} 32