diff options
author | Anna Zaks <ganna@apple.com> | 2011-12-01 05:57:37 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-12-01 05:57:37 +0000 |
commit | c6aa531a8f89d5b671aea57576f40b205784b530 (patch) | |
tree | 54dc487bfe8c2bc259c7bcfe5f4283c7cb2d12a2 /clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp | |
parent | 24fc93a9400253253587dda239a287197ee47365 (diff) | |
download | bcm5719-llvm-c6aa531a8f89d5b671aea57576f40b205784b530.tar.gz bcm5719-llvm-c6aa531a8f89d5b671aea57576f40b205784b530.zip |
[analyzer] Refactor checkers to use helper function for getting callee Decl and name.
We are getting name of the called function or it's declaration in a few checkers. Refactor them to use the helper function in the CheckerContext.
llvm-svn: 145576
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp index 4299a12e387..6ab98b41870 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -1664,20 +1664,9 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallExpr *CE, //===----------------------------------------------------------------------===// bool CStringChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { - // Get the callee. All the functions we care about are C functions - // with simple identifiers. - const ProgramState *state = C.getState(); - const Expr *Callee = CE->getCallee(); - const FunctionDecl *FD = state->getSVal(Callee).getAsFunctionDecl(); - - if (!FD) - return false; - - // Get the name of the callee. If it's a builtin, strip off the prefix. - IdentifierInfo *II = FD->getIdentifier(); - if (!II) // if no identifier, not a simple C function + StringRef Name = C.getCalleeName(CE); + if (Name.empty()) return false; - StringRef Name = II->getName(); if (Name.startswith("__builtin_")) Name = Name.substr(10); |