aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnton Yartsev <anton.yartsev@gmail.com>2013-04-05 11:25:10 +0000
committerAnton Yartsev <anton.yartsev@gmail.com>2013-04-05 11:25:10 +0000
commita3ae937ab7b7026953b6e93e0159cf1dd918e2a1 (patch)
tree71174d036ee3e51fb5a63132f0ea341d00448f26 /lib
parent0c2b10485317afa88fb25ad917ee238e76342f08 (diff)
[analyzer] Path notes for the MismatchedDeallocator checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/StaticAnalyzer/Checkers/MallocChecker.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 4b0e7661d8..318be5bf10 100644
--- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -293,8 +293,8 @@ private:
void ReportBadFree(CheckerContext &C, SVal ArgVal, SourceRange Range,
const Expr *DeallocExpr) const;
void ReportMismatchedDealloc(CheckerContext &C, SourceRange Range,
- const Expr *DeallocExpr,
- const RefState *RS) const;
+ const Expr *DeallocExpr, const RefState *RS,
+ SymbolRef Sym) const;
void ReportOffsetFree(CheckerContext &C, SVal ArgVal, SourceRange Range,
const Expr *DeallocExpr,
const Expr *AllocExpr = 0) const;
@@ -1013,7 +1013,8 @@ ProgramStateRef MallocChecker::FreeMemAux(CheckerContext &C,
// Check if an expected deallocation function matches the real one.
if (!DeallocMatchesAlloc && RsBase->isAllocated()) {
- ReportMismatchedDealloc(C, ArgExpr->getSourceRange(), ParentExpr, RsBase);
+ ReportMismatchedDealloc(C, ArgExpr->getSourceRange(), ParentExpr, RsBase,
+ SymBase);
return 0;
}
@@ -1236,7 +1237,8 @@ void MallocChecker::ReportBadFree(CheckerContext &C, SVal ArgVal,
void MallocChecker::ReportMismatchedDealloc(CheckerContext &C,
SourceRange Range,
const Expr *DeallocExpr,
- const RefState *RS) const {
+ const RefState *RS,
+ SymbolRef Sym) const {
if (!Filter.CMismatchedDeallocatorChecker)
return;
@@ -1266,7 +1268,9 @@ void MallocChecker::ReportMismatchedDealloc(CheckerContext &C,
os << ", not " << DeallocOs.str();
BugReport *R = new BugReport(*BT_MismatchedDealloc, os.str(), N);
+ R->markInteresting(Sym);
R->addRange(Range);
+ R->addVisitor(new MallocBugVisitor(Sym));
C.emitReport(R);
}
}