aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-10 23:13:01 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-10 23:13:01 +0000
commit6cd16c5152afcf00b3097d1326301e84dae55c33 (patch)
treed2e3ec59e3f8f3d10f996142fe75218bb51b282c /clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
parente8cb2fc61696ba9efc5d2591b972f81f6938d45f (diff)
downloadllvm-6cd16c5152afcf00b3097d1326301e84dae55c33.zip
llvm-6cd16c5152afcf00b3097d1326301e84dae55c33.tar.gz
llvm-6cd16c5152afcf00b3097d1326301e84dae55c33.tar.bz2
[analyzer] Guard against C++ member functions that look like system functions.
C++ method calls and C function calls both appear as CallExprs in the AST. This was causing crashes for an object that had a 'free' method. <rdar://problem/11822244> llvm-svn: 160029
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
index 60e665fe..600de65 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
@@ -325,7 +325,11 @@ void UnixAPIChecker::CheckVallocZero(CheckerContext &C,
void UnixAPIChecker::checkPreStmt(const CallExpr *CE,
CheckerContext &C) const {
- StringRef FName = C.getCalleeName(CE);
+ const FunctionDecl *FD = C.getCalleeDecl(CE);
+ if (!FD || FD->getKind() != Decl::Function)
+ return;
+
+ StringRef FName = C.getCalleeName(FD);
if (FName.empty())
return;