summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-20 01:55:32 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-20 01:55:32 +0000
commitd6e5fd52f0d8d59a8c1340439c40564d782eb22a (patch)
tree23a6ed26482a3d0f77fdfe84abd87bb952986907 /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
parentae134c64494af5bce1414e754fad0d8b5f99ee33 (diff)
downloadbcm5719-llvm-d6e5fd52f0d8d59a8c1340439c40564d782eb22a.tar.gz
bcm5719-llvm-d6e5fd52f0d8d59a8c1340439c40564d782eb22a.zip
[analyzer] MallocChecker should not do post-call checks on inlined functions.
If someone provides their own function called 'strdup', or 'reallocf', or even 'malloc', and we inlined it, the inlining should have given us all the malloc-related information we need. If we then try to attach new information to the return value, we could end up with spurious warnings. <rdar://problem/12317671> llvm-svn: 164276
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index c036d739dd4..3a27d552218 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -442,6 +442,9 @@ bool MallocChecker::isFreeFunction(const FunctionDecl *FD, ASTContext &C) const
}
void MallocChecker::checkPostStmt(const CallExpr *CE, CheckerContext &C) const {
+ if (C.wasInlined)
+ return;
+
const FunctionDecl *FD = C.getCalleeDecl(CE);
if (!FD)
return;
OpenPOWER on IntegriCloud