[PATCH] D31541: [analyzer] MisusedMovedObjectChecker: Add a printState() method.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 10 04:50:52 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315300: [analyzer] MisusedMovedObject: Add printState() method for self-debugging. (authored by dergachev).
Changed prior to commit:
https://reviews.llvm.org/D31541?vs=93661&id=118350#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31541
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
@@ -56,6 +56,8 @@
ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions,
const LocationContext *LCtx, const CallEvent *Call) const;
+ void printState(raw_ostream &Out, ProgramStateRef State,
+ const char *NL, const char *Sep) const override;
private:
class MovedBugVisitor : public BugReporterVisitorImpl<MovedBugVisitor> {
@@ -476,6 +478,25 @@
return State;
}
+void MisusedMovedObjectChecker::printState(raw_ostream &Out,
+ ProgramStateRef State,
+ const char *NL,
+ const char *Sep) const {
+
+ TrackedRegionMapTy RS = State->get<TrackedRegionMap>();
+
+ if (!RS.isEmpty()) {
+ Out << Sep << "Moved-from objects :" << NL;
+ for (auto I: RS) {
+ I.first->dumpToStream(Out);
+ if (I.second.isMoved())
+ Out << ": moved";
+ else
+ Out << ": moved and reported";
+ Out << NL;
+ }
+ }
+}
void ento::registerMisusedMovedObjectChecker(CheckerManager &mgr) {
mgr.registerChecker<MisusedMovedObjectChecker>();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31541.118350.patch
Type: text/x-patch
Size: 1492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171010/927f1386/attachment.bin>
More information about the cfe-commits
mailing list