[PATCH] Add ForEachChunk() to sanitizer allocators.

Sergey Matveev earthdok at google.com
Sun Mar 17 19:46:29 PDT 2013



================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:571
@@ +570,3 @@
+ public:
+  explicit IterationTestCallback(std::set<void *> *chunks)
+    : chunks_(chunks) {}
----------------
David Blaikie wrote:
> (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.
Sanitizer code actually follows the Google style guide, which strongly prohibits non-const reference parameters.

TBH I should've made the parameter to ForEachChunk a pointer. The way it is now is pretty awkward.


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


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



More information about the llvm-commits mailing list