summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:36 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:36 +0000
commitd86b3bdb7ad54e29ea8efda85d0110218c0431a7 (patch)
tree13395b71f8aa2970f7b2d91c6d7f64d22edb2875 /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
parent356279ca2de74b0deb274a8b16396bdaebfec92b (diff)
downloadbcm5719-llvm-d86b3bdb7ad54e29ea8efda85d0110218c0431a7.tar.gz
bcm5719-llvm-d86b3bdb7ad54e29ea8efda85d0110218c0431a7.zip
[analyzer] Clean up the printing of FieldRegions for leaks.
Unfortunately, generalized region printing is very difficult: - ElementRegions are used both for casting and as actual elements. - Accessing values through a pointer means going through an intermediate SymbolRegionValue; symbolic regions are untyped. - Referring to implicitly-defined variables like 'this' and 'self' could be very confusing if they come from another stack frame. We fall back to simply not printing the region name if we can't be sure it will print well. This will allow us to improve in the future. llvm-svn: 161512
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index d384bc34f9a..56221801e54 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -1000,10 +1000,9 @@ void MallocChecker::reportLeak(SymbolRef Sym, ExplodedNode *N,
SmallString<200> buf;
llvm::raw_svector_ostream os(buf);
os << "Memory is never released; potential leak";
- // FIXME: Make all region pretty-printing nice enough to show.
- if (Region && isa<VarRegion>(Region)) {
+ if (Region && Region->canPrintPretty()) {
os << " of memory pointed to by '";
- Region->dumpPretty(os);
+ Region->printPretty(os);
os << '\'';
}
OpenPOWER on IntegriCloud