Roll src/third_party/WebKit 06cb9e9:a978ee5 (svn 202558:202559)
[chromium-blink-merge.git] / third_party / re2 / patches / re2-msan.patch
blob857766927fb55b76a4c16c6a97010326dcdb4468
1 diff --git a/third_party/re2/util/sparse_array.h b/third_party/re2/util/sparse_array.h
2 index 3e33f89..4ee5c94 100644
3 --- a/third_party/re2/util/sparse_array.h
4 +++ b/third_party/re2/util/sparse_array.h
5 @@ -231,7 +231,8 @@ class SparseArray {
7 template<typename Value>
8 SparseArray<Value>::SparseArray()
9 - : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(), valgrind_(RunningOnValgrind()) {}
10 + : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(),
11 + valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
13 // IndexValue pairs: exposed in SparseArray::iterator.
14 template<typename Value>
15 @@ -418,7 +419,7 @@ void SparseArray<Value>::create_index(int i) {
16 template<typename Value> SparseArray<Value>::SparseArray(int max_size) {
17 max_size_ = max_size;
18 sparse_to_dense_ = new int[max_size];
19 - valgrind_ = RunningOnValgrind();
20 + valgrind_ = RunningOnValgrindOrMemorySanitizer();
21 dense_.resize(max_size);
22 // Don't need to zero the new memory, but appease Valgrind.
23 if (valgrind_) {
24 diff --git a/third_party/re2/util/sparse_set.h b/third_party/re2/util/sparse_set.h
25 index 165dd09..4a324d7 100644
26 --- a/third_party/re2/util/sparse_set.h
27 +++ b/third_party/re2/util/sparse_set.h
28 @@ -54,13 +54,14 @@ namespace re2 {
29 class SparseSet {
30 public:
31 SparseSet()
32 - : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL), valgrind_(RunningOnValgrind()) {}
33 + : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL),
34 + valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
36 SparseSet(int max_size) {
37 max_size_ = max_size;
38 sparse_to_dense_ = new int[max_size];
39 dense_ = new int[max_size];
40 - valgrind_ = RunningOnValgrind();
41 + valgrind_ = RunningOnValgrindOrMemorySanitizer();
42 // Don't need to zero the memory, but do so anyway
43 // to appease Valgrind.
44 if (valgrind_) {
45 diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
46 index de1ef5b..49159c2 100644
47 --- a/third_party/re2/util/util.h
48 +++ b/third_party/re2/util/util.h
49 @@ -129,6 +129,14 @@ static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
50 return ((uint64)x << 32) | y;
53 +inline bool RunningOnValgrindOrMemorySanitizer() {
54 +#if defined(MEMORY_SANITIZER)
55 + return true;
56 +#else
57 + return RunningOnValgrind();
58 +#endif
61 } // namespace re2
63 #include "util/arena.h"