[PATCH] D32747: [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 5 02:43:26 PDT 2018


whisperity added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:92
+  // Whether iterator is valid
+  bool Valid;
+
----------------
Seeing that in line 106 you consider this record immutable, you might want to add a `const` on this field too.


================
Comment at: test/Analysis/invalidated-iterator.cpp:32
+  *i0; // expected-warning{{Invalidated iterator accessed}}
+}
----------------
This might not be applicable here, but isn't there a test case for copy operations where the iterator isn't invalidated? Something of a positive test to be added here. My only idea is something with weird reference-to-pointer magic. Might not worth the hassle.


https://reviews.llvm.org/D32747





More information about the cfe-commits mailing list