[cfe-commits] r171439 - /cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
Ted Kremenek
kremenek at apple.com
Wed Jan 2 17:30:13 PST 2013
Author: kremenek
Date: Wed Jan 2 19:30:12 2013
New Revision: 171439
URL: http://llvm.org/viewvc/llvm-project?rev=171439&view=rev
Log:
Make MallocChecker debug output useful.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=171439&r1=171438&r2=171439&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Jan 2 19:30:12 2013
@@ -70,6 +70,19 @@
ID.AddInteger(K);
ID.AddPointer(S);
}
+
+ void dump(llvm::raw_ostream &OS) const {
+ static const char *Table[] = {
+ "Allocated",
+ "Released",
+ "Relinquished"
+ };
+ OS << Table[(unsigned) K];
+ }
+
+ LLVM_ATTRIBUTE_USED void dump() const {
+ dump(llvm::errs());
+ }
};
enum ReallocPairKind {
@@ -1561,8 +1574,15 @@
RegionStateTy RS = State->get<RegionState>();
- if (!RS.isEmpty())
- Out << "Has Malloc data" << NL;
+ if (!RS.isEmpty()) {
+ Out << Sep << "MallocChecker:" << NL;
+ for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
+ I.getKey()->dumpToStream(Out);
+ Out << " : ";
+ I.getData().dump(Out);
+ Out << NL;
+ }
+ }
}
#define REGISTER_CHECKER(name) \
More information about the cfe-commits
mailing list