Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: third_party/re2/util/sparse_set.h

Issue 149723005: Patch re2 to support MSan. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address eugenis's suggestions Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/re2/util/sparse_array.h ('k') | third_party/re2/util/util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006 The RE2 Authors. All Rights Reserved. 1 // Copyright 2006 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // DESCRIPTION 5 // DESCRIPTION
6 // 6 //
7 // SparseSet<T>(m) is a set of integers in [0, m). 7 // SparseSet<T>(m) is a set of integers in [0, m).
8 // It requires sizeof(int)*m memory, but it provides 8 // It requires sizeof(int)*m memory, but it provides
9 // fast iteration through the elements in the set and fast clearing 9 // fast iteration through the elements in the set and fast clearing
10 // of the set. 10 // of the set.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #ifndef RE2_UTIL_SPARSE_SET_H__ 47 #ifndef RE2_UTIL_SPARSE_SET_H__
48 #define RE2_UTIL_SPARSE_SET_H__ 48 #define RE2_UTIL_SPARSE_SET_H__
49 49
50 #include "util/util.h" 50 #include "util/util.h"
51 51
52 namespace re2 { 52 namespace re2 {
53 53
54 class SparseSet { 54 class SparseSet {
55 public: 55 public:
56 SparseSet() 56 SparseSet()
57 : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL), valgrind_(Ru nningOnValgrind()) {} 57 : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL),
58 valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
58 59
59 SparseSet(int max_size) { 60 SparseSet(int max_size) {
60 max_size_ = max_size; 61 max_size_ = max_size;
61 sparse_to_dense_ = new int[max_size]; 62 sparse_to_dense_ = new int[max_size];
62 dense_ = new int[max_size]; 63 dense_ = new int[max_size];
63 valgrind_ = RunningOnValgrind(); 64 valgrind_ = RunningOnValgrindOrMemorySanitizer();
64 // Don't need to zero the memory, but do so anyway 65 // Don't need to zero the memory, but do so anyway
65 // to appease Valgrind. 66 // to appease Valgrind.
66 if (valgrind_) { 67 if (valgrind_) {
67 for (int i = 0; i < max_size; i++) { 68 for (int i = 0; i < max_size; i++) {
68 dense_[i] = 0xababababU; 69 dense_[i] = 0xababababU;
69 sparse_to_dense_[i] = 0xababababU; 70 sparse_to_dense_[i] = 0xababababU;
70 } 71 }
71 } 72 }
72 size_ = 0; 73 size_ = 0;
73 } 74 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int* sparse_to_dense_; 171 int* sparse_to_dense_;
171 int* dense_; 172 int* dense_;
172 bool valgrind_; 173 bool valgrind_;
173 174
174 DISALLOW_EVIL_CONSTRUCTORS(SparseSet); 175 DISALLOW_EVIL_CONSTRUCTORS(SparseSet);
175 }; 176 };
176 177
177 } // namespace re2 178 } // namespace re2
178 179
179 #endif // RE2_UTIL_SPARSE_SET_H__ 180 #endif // RE2_UTIL_SPARSE_SET_H__
OLDNEW
« no previous file with comments | « third_party/re2/util/sparse_array.h ('k') | third_party/re2/util/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698