[PATCH] Add ForEachChunk() to sanitizer allocators.

David Blaikie dblaikie at gmail.com
Fri Mar 15 10:35:10 PDT 2013



================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:571
@@ +570,3 @@
+ public:
+  explicit IterationTestCallback(std::set<void *> *chunks)
+    : chunks_(chunks) {}
----------------
(not important, but just a thought)

The LLVM project codebase doesn't really have the convention to pass mutable data by pointer (we're usually more than happy to pass by non-const ref). Not sure if the sanitizer code has adopted this convention consistently/separately from the rest of LLVM.

================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:610
@@ +609,3 @@
+  a->ForceLock();
+  a->template ForEachChunk<IterationTestCallback>(callback);
+  a->ForceUnlock();
----------------
Any reason you can't just call this with "a->ForEachChunk(callback)", relying on template argument deduction?

================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:650
@@ +649,3 @@
+  a.ForceLock();
+  a.ForEachChunk<IterationTestCallback>(callback);
+  a.ForceUnlock();
----------------
Also here you can probably drop the explicit template argument.


http://llvm-reviews.chandlerc.com/D539



More information about the llvm-commits mailing list