[compiler-rt] r319650 - Move __tsan::Vector to __sanitizer

Kamil Rytarowski via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 04:30:09 PST 2017


Author: kamil
Date: Mon Dec  4 04:30:09 2017
New Revision: 319650

URL: http://llvm.org/viewvc/llvm-project?rev=319650&view=rev
Log:
Move __tsan::Vector to __sanitizer

Summary:
The low-fat STL-like vector container will be reused in MSan.

It is needed to implement an atexit(3) interceptor on NetBSD/amd64 in MSan.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc

Reviewed By: dvyukov

Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D40726

Added:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_vector.h
      - copied, changed from r319649, compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_vector_test.cc
      - copied, changed from r319649, compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc
Removed:
    compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h
    compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc
Modified:
    compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
    compiler-rt/trunk/lib/tsan/tests/unit/CMakeLists.txt

Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Mon Dec  4 04:30:09 2017
@@ -140,6 +140,7 @@ set(SANITIZER_HEADERS
   sanitizer_syscall_linux_x86_64.inc
   sanitizer_syscall_linux_aarch64.inc
   sanitizer_thread_registry.h
+  sanitizer_vector.h
   sanitizer_win.h)
 
 include_directories(..)

Copied: compiler-rt/trunk/lib/sanitizer_common/sanitizer_vector.h (from r319649, compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_vector.h?p2=compiler-rt/trunk/lib/sanitizer_common/sanitizer_vector.h&p1=compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h&r1=319649&r2=319650&rev=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_vector.h Mon Dec  4 04:30:09 2017
@@ -1,4 +1,4 @@
-//===-- tsan_vector.h -------------------------------------------*- C++ -*-===//
+//===-- sanitizer_vector.h -------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,38 +7,37 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file is a part of ThreadSanitizer (TSan), a race detector.
+// This file is shared between sanitizers run-time libraries.
 //
 //===----------------------------------------------------------------------===//
 
 // Low-fat STL-like vector container.
 
-#ifndef TSAN_VECTOR_H
-#define TSAN_VECTOR_H
+#ifndef SANITIZER_VECTOR_H
+#define SANITIZER_VECTOR_H
 
-#include "tsan_defs.h"
-#include "tsan_mman.h"
+#include "sanitizer_common/sanitizer_allocator_internal.h"
+#include "sanitizer_common/sanitizer_libc.h"
 
-namespace __tsan {
+namespace __sanitizer {
 
 template<typename T>
 class Vector {
  public:
-  explicit Vector(MBlockType typ)
-      : typ_(typ)
-      , begin_()
+  explicit Vector()
+      : begin_()
       , end_()
       , last_() {
   }
 
   ~Vector() {
     if (begin_)
-      internal_free(begin_);
+      InternalFree(begin_);
   }
 
   void Reset() {
     if (begin_)
-      internal_free(begin_);
+      InternalFree(begin_);
     begin_ = 0;
     end_ = 0;
     last_ = 0;
@@ -91,7 +90,6 @@ class Vector {
   }
 
  private:
-  const MBlockType typ_;
   T *begin_;
   T *end_;
   T *last_;
@@ -109,10 +107,10 @@ class Vector {
       cap = 16;
     if (cap < size)
       cap = size;
-    T *p = (T*)internal_alloc(typ_, cap * sizeof(T));
+    T *p = (T*)InternalAlloc(cap * sizeof(T));
     if (cap0) {
       internal_memcpy(p, begin_, cap0 * sizeof(T));
-      internal_free(begin_);
+      InternalFree(begin_);
     }
     begin_ = p;
     end_ = begin_ + size;
@@ -122,6 +120,6 @@ class Vector {
   Vector(const Vector&);
   void operator=(const Vector&);
 };
-}  // namespace __tsan
+}  // namespace __sanitizer
 
-#endif  // #ifndef TSAN_VECTOR_H
+#endif  // #ifndef SANITIZER_VECTOR_H

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Mon Dec  4 04:30:09 2017
@@ -34,7 +34,8 @@ set(SANITIZER_UNITTESTS
   sanitizer_suppressions_test.cc
   sanitizer_symbolizer_test.cc
   sanitizer_test_main.cc
-  sanitizer_thread_registry_test.cc)
+  sanitizer_thread_registry_test.cc
+  sanitizer_vector_test.cc)
 
 set(SANITIZER_TEST_HEADERS
   sanitizer_pthread_wrappers.h

Copied: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_vector_test.cc (from r319649, compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_vector_test.cc?p2=compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_vector_test.cc&p1=compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc&r1=319649&r2=319650&rev=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_vector_test.cc Mon Dec  4 04:30:09 2017
@@ -1,4 +1,4 @@
-//===-- tsan_vector_test.cc -----------------------------------------------===//
+//===-- sanitizer_vector_test.cc ------------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,17 +7,16 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file is a part of ThreadSanitizer (TSan), a race detector.
+// This file is a part of *Sanitizer runtime.
 //
 //===----------------------------------------------------------------------===//
-#include "tsan_vector.h"
-#include "tsan_rtl.h"
+#include "sanitizer_common/sanitizer_vector.h"
 #include "gtest/gtest.h"
 
-namespace __tsan {
+namespace __sanitizer {
 
 TEST(Vector, Basic) {
-  Vector<int> v(MBlockScopedBuf);
+  Vector<int> v;
   EXPECT_EQ(v.Size(), (uptr)0);
   v.PushBack(42);
   EXPECT_EQ(v.Size(), (uptr)1);
@@ -29,7 +28,7 @@ TEST(Vector, Basic) {
 }
 
 TEST(Vector, Stride) {
-  Vector<int> v(MBlockScopedBuf);
+  Vector<int> v;
   for (int i = 0; i < 1000; i++) {
     v.PushBack(i);
     EXPECT_EQ(v.Size(), (uptr)(i + 1));
@@ -40,4 +39,4 @@ TEST(Vector, Stride) {
   }
 }
 
-}  // namespace __tsan
+}  // namespace __sanitizer

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Mon Dec  4 04:30:09 2017
@@ -93,8 +93,7 @@ set(TSAN_HEADERS
   rtl/tsan_symbolize.h
   rtl/tsan_sync.h
   rtl/tsan_trace.h
-  rtl/tsan_update_shadow_word_inl.h
-  rtl/tsan_vector.h)
+  rtl/tsan_update_shadow_word_inl.h)
 
 set(TSAN_RUNTIME_LIBRARIES)
 add_compiler_rt_component(tsan)

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Mon Dec  4 04:30:09 2017
@@ -200,7 +200,7 @@ struct InterceptorContext {
   Vector<struct AtExitCtx *> AtExitStack;
 
   InterceptorContext()
-      : libignore(LINKER_INITIALIZED), AtExitStack(MBlockAtExit) {
+      : libignore(LINKER_INITIALIZED), AtExitStack() {
   }
 };
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc Mon Dec  4 04:30:09 2017
@@ -14,6 +14,7 @@
 #include "sanitizer_common/sanitizer_internal_defs.h"
 #include "sanitizer_common/sanitizer_placement_new.h"
 #include "sanitizer_common/sanitizer_stacktrace.h"
+#include "sanitizer_common/sanitizer_vector.h"
 #include "tsan_interface_ann.h"
 #include "tsan_mutex.h"
 #include "tsan_report.h"
@@ -21,7 +22,6 @@
 #include "tsan_mman.h"
 #include "tsan_flags.h"
 #include "tsan_platform.h"
-#include "tsan_vector.h"
 
 #define CALLERPC ((uptr)__builtin_return_address(0))
 
@@ -185,10 +185,10 @@ void PrintMatchedBenignRaces() {
   int unique_count = 0;
   int hit_count = 0;
   int add_count = 0;
-  Vector<ExpectRace> hit_matched(MBlockScopedBuf);
+  Vector<ExpectRace> hit_matched;
   CollectMatchedBenignRaces(&hit_matched, &unique_count, &hit_count,
       &ExpectRace::hitcount);
-  Vector<ExpectRace> add_matched(MBlockScopedBuf);
+  Vector<ExpectRace> add_matched;
   CollectMatchedBenignRaces(&add_matched, &unique_count, &add_count,
       &ExpectRace::addcount);
   if (hit_matched.Size()) {

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Mon Dec  4 04:30:09 2017
@@ -48,18 +48,18 @@ class Decorator: public __sanitizer::San
 
 ReportDesc::ReportDesc()
     : tag(kExternalTagNone)
-    , stacks(MBlockReportStack)
-    , mops(MBlockReportMop)
-    , locs(MBlockReportLoc)
-    , mutexes(MBlockReportMutex)
-    , threads(MBlockReportThread)
-    , unique_tids(MBlockReportThread)
+    , stacks()
+    , mops()
+    , locs()
+    , mutexes()
+    , threads()
+    , unique_tids()
     , sleep()
     , count() {
 }
 
 ReportMop::ReportMop()
-    : mset(MBlockReportMutex) {
+    : mset() {
 }
 
 ReportDesc::~ReportDesc() {

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.h?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.h Mon Dec  4 04:30:09 2017
@@ -14,8 +14,8 @@
 #define TSAN_REPORT_H
 
 #include "sanitizer_common/sanitizer_symbolizer.h"
+#include "sanitizer_common/sanitizer_vector.h"
 #include "tsan_defs.h"
-#include "tsan_vector.h"
 
 namespace __tsan {
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Mon Dec  4 04:30:09 2017
@@ -102,8 +102,8 @@ Context::Context()
   , thread_registry(new(thread_registry_placeholder) ThreadRegistry(
       CreateThreadContext, kMaxTid, kThreadQuarantineSize, kMaxTidReuse))
   , racy_mtx(MutexTypeRacy, StatMtxRacy)
-  , racy_stacks(MBlockRacyStacks)
-  , racy_addresses(MBlockRacyAddresses)
+  , racy_stacks()
+  , racy_addresses()
   , fired_suppressions_mtx(MutexTypeFired, StatMtxFired)
   , fired_suppressions(8)
   , clock_alloc("clock allocator") {
@@ -121,7 +121,7 @@ ThreadState::ThreadState(Context *ctx, i
   // , ignore_interceptors()
   , clock(tid, reuse_count)
 #if !SANITIZER_GO
-  , jmp_bufs(MBlockJmpBuf)
+  , jmp_bufs()
 #endif
   , tid(tid)
   , unique_id(unique_id)

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Mon Dec  4 04:30:09 2017
@@ -34,12 +34,13 @@
 #include "sanitizer_common/sanitizer_libignore.h"
 #include "sanitizer_common/sanitizer_suppressions.h"
 #include "sanitizer_common/sanitizer_thread_registry.h"
+#include "sanitizer_common/sanitizer_vector.h"
 #include "tsan_clock.h"
 #include "tsan_defs.h"
 #include "tsan_flags.h"
+#include "tsan_mman.h"
 #include "tsan_sync.h"
 #include "tsan_trace.h"
-#include "tsan_vector.h"
 #include "tsan_report.h"
 #include "tsan_platform.h"
 #include "tsan_mutexset.h"

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Mon Dec  4 04:30:09 2017
@@ -393,7 +393,7 @@ void RestoreStack(int tid, const u64 epo
   const u64 ebegin = RoundDown(eend, kTracePartSize);
   DPrintf("#%d: RestoreStack epoch=%zu ebegin=%zu eend=%zu partidx=%d\n",
           tid, (uptr)epoch, (uptr)ebegin, (uptr)eend, partidx);
-  Vector<uptr> stack(MBlockReportStack);
+  Vector<uptr> stack;
   stack.Resize(hdr->stack0.size + 64);
   for (uptr i = 0; i < hdr->stack0.size; i++) {
     stack[i] = hdr->stack0.trace[i];
@@ -659,7 +659,7 @@ void ReportRace(ThreadState *thr) {
     return;
 
   // MutexSet is too large to live on stack.
-  Vector<u64> mset_buffer(MBlockScopedBuf);
+  Vector<u64> mset_buffer;
   mset_buffer.Resize(sizeof(MutexSet) / sizeof(u64) + 1);
   MutexSet *mset2 = new(&mset_buffer[0]) MutexSet();
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Mon Dec  4 04:30:09 2017
@@ -211,7 +211,7 @@ void ThreadFinalize(ThreadState *thr) {
   if (!flags()->report_thread_leaks)
     return;
   ThreadRegistryLock l(ctx->thread_registry);
-  Vector<ThreadLeak> leaks(MBlockScopedBuf);
+  Vector<ThreadLeak> leaks;
   ctx->thread_registry->RunCallbackForEachThreadLocked(
       MaybeReportThreadLeak, &leaks);
   for (uptr i = 0; i < leaks.Size(); i++) {

Removed: compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h?rev=319649&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_vector.h (removed)
@@ -1,127 +0,0 @@
-//===-- tsan_vector.h -------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of ThreadSanitizer (TSan), a race detector.
-//
-//===----------------------------------------------------------------------===//
-
-// Low-fat STL-like vector container.
-
-#ifndef TSAN_VECTOR_H
-#define TSAN_VECTOR_H
-
-#include "tsan_defs.h"
-#include "tsan_mman.h"
-
-namespace __tsan {
-
-template<typename T>
-class Vector {
- public:
-  explicit Vector(MBlockType typ)
-      : typ_(typ)
-      , begin_()
-      , end_()
-      , last_() {
-  }
-
-  ~Vector() {
-    if (begin_)
-      internal_free(begin_);
-  }
-
-  void Reset() {
-    if (begin_)
-      internal_free(begin_);
-    begin_ = 0;
-    end_ = 0;
-    last_ = 0;
-  }
-
-  uptr Size() const {
-    return end_ - begin_;
-  }
-
-  T &operator[](uptr i) {
-    DCHECK_LT(i, end_ - begin_);
-    return begin_[i];
-  }
-
-  const T &operator[](uptr i) const {
-    DCHECK_LT(i, end_ - begin_);
-    return begin_[i];
-  }
-
-  T *PushBack() {
-    EnsureSize(Size() + 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() {
-    DCHECK_GT(end_, begin_);
-    end_--;
-  }
-
-  void Resize(uptr size) {
-    if (size == 0) {
-      end_ = begin_;
-      return;
-    }
-    uptr old_size = Size();
-    EnsureSize(size);
-    if (old_size < size) {
-      for (uptr i = old_size; i < size; i++)
-        internal_memset(&begin_[i], 0, sizeof(begin_[i]));
-    }
-  }
-
- private:
-  const MBlockType typ_;
-  T *begin_;
-  T *end_;
-  T *last_;
-
-  void EnsureSize(uptr size) {
-    if (size <= Size())
-      return;
-    if (size <= (uptr)(last_ - begin_)) {
-      end_ = begin_ + size;
-      return;
-    }
-    uptr cap0 = last_ - begin_;
-    uptr cap = cap0 * 5 / 4;  // 25% growth
-    if (cap == 0)
-      cap = 16;
-    if (cap < size)
-      cap = size;
-    T *p = (T*)internal_alloc(typ_, cap * sizeof(T));
-    if (cap0) {
-      internal_memcpy(p, begin_, cap0 * sizeof(T));
-      internal_free(begin_);
-    }
-    begin_ = p;
-    end_ = begin_ + size;
-    last_ = begin_ + cap;
-  }
-
-  Vector(const Vector&);
-  void operator=(const Vector&);
-};
-}  // namespace __tsan
-
-#endif  // #ifndef TSAN_VECTOR_H

Modified: compiler-rt/trunk/lib/tsan/tests/unit/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/unit/CMakeLists.txt?rev=319650&r1=319649&r2=319650&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/unit/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/tests/unit/CMakeLists.txt Mon Dec  4 04:30:09 2017
@@ -6,8 +6,7 @@ set(TSAN_UNIT_TEST_SOURCES
   tsan_shadow_test.cc
   tsan_stack_test.cc
   tsan_sync_test.cc
-  tsan_unit_test_main.cc
-  tsan_vector_test.cc)
+  tsan_unit_test_main.cc)
 
 add_tsan_unittest(TsanUnitTest
   SOURCES ${TSAN_UNIT_TEST_SOURCES})

Removed: compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc?rev=319649&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/tests/unit/tsan_vector_test.cc (removed)
@@ -1,43 +0,0 @@
-//===-- tsan_vector_test.cc -----------------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of ThreadSanitizer (TSan), a race detector.
-//
-//===----------------------------------------------------------------------===//
-#include "tsan_vector.h"
-#include "tsan_rtl.h"
-#include "gtest/gtest.h"
-
-namespace __tsan {
-
-TEST(Vector, Basic) {
-  Vector<int> v(MBlockScopedBuf);
-  EXPECT_EQ(v.Size(), (uptr)0);
-  v.PushBack(42);
-  EXPECT_EQ(v.Size(), (uptr)1);
-  EXPECT_EQ(v[0], 42);
-  v.PushBack(43);
-  EXPECT_EQ(v.Size(), (uptr)2);
-  EXPECT_EQ(v[0], 42);
-  EXPECT_EQ(v[1], 43);
-}
-
-TEST(Vector, Stride) {
-  Vector<int> v(MBlockScopedBuf);
-  for (int i = 0; i < 1000; i++) {
-    v.PushBack(i);
-    EXPECT_EQ(v.Size(), (uptr)(i + 1));
-    EXPECT_EQ(v[i], i);
-  }
-  for (int i = 0; i < 1000; i++) {
-    EXPECT_EQ(v[i], i);
-  }
-}
-
-}  // namespace __tsan




More information about the llvm-commits mailing list