summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_vector.h')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_vector.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_vector.h b/compiler-rt/lib/tsan/rtl/tsan_vector.h
index fa236b1f1e4..bd2363ff74a 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_vector.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_vector.h
@@ -58,10 +58,18 @@ class Vector {
return begin_[i];
}
- T *PushBack(T v = T()) {
+ T *PushBack() {
EnsureSize(Size() + 1);
- end_[-1] = v;
- return &end_[-1];
+ T *p = &end_[-1];
+ internal_memset(p, 0, sizeof(*p));
+ return p;
+ }
+
+ T *PushBack(const T& v) {
+ EnsureSize(Size() + 1);
+ T *p = &end_[-1];
+ internal_memcpy(p, &v, sizeof(*p));
+ return p;
}
void PopBack() {
OpenPOWER on IntegriCloud