[PATCH] D19679: Method pool in modules: sync up out of date selectors before writing the module

Doug Gregor via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 11:15:21 PDT 2016


doug.gregor added a comment.

Mostly looks good, but see my comment about MapVector invalidation.


================
Comment at: lib/Serialization/ASTWriter.cpp:4394
@@ +4393,3 @@
+  // date, so we need to pull in the new content here.
+  for (auto &SelectorAndID : SelectorIDs)
+    SemaRef.updateOutOfDateSelector(SelectorAndID.first);
----------------
Are we certain that SelectorIDs cannot get updated during this iteration under any circumstances? If the underlying vector were to get reallocated, we'd end up with a horrible-to-reproduce use-after-free here. It might be worth copying SelectorIDs or indexing by an integer value rather than using the for-each loop.


http://reviews.llvm.org/D19679





More information about the cfe-commits mailing list