[PATCH] D51196: Add a RingBuffer class to sanitizer_common
Kostya Serebryany via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 28 15:50:23 PDT 2018
kcc added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_ring_buffer.h:30
+ RB->last_ = RB->next_ = reinterpret_cast<T*>(End - sizeof(T));
+ CHECK_GE(sizeof(T), sizeof(void*));
+ return RB;
----------------
eugenis wrote:
> I think you need to check that sizeof(T) is divisible by sizeof(void*), otherwise wrap-around check is not correct.
done
================
Comment at: lib/sanitizer_common/sanitizer_ring_buffer.h:51
+ CHECK_LT(Idx, size());
+ T *Ptr = next_ + 1 + Idx;
+ if (Ptr > last_)
----------------
eugenis wrote:
> I think this is UB.
done
================
Comment at: lib/sanitizer_common/sanitizer_ring_buffer.h:59
+ RingBuffer() {}
+ ~RingBuffer() {}
+
----------------
eugenis wrote:
> delete copy constructor?
done
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D51196
More information about the llvm-commits
mailing list