diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-05-07 05:56:24 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-05-07 05:56:24 +0000 |
commit | 1d754d2b06bbd1864d6ceafc98d933a277af0cbe (patch) | |
tree | 30a4d76bf1decd3ab1c5ba52f76d149966bf6129 /lib/lsan | |
parent | 37bd23415794895d170e1f0b9a7d788406e2aa86 (diff) |
[sanitizer] Remove reserving constructor from InternalMmapVector
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan')
-rw-r--r-- | lib/lsan/lsan_common.cc | 6 | ||||
-rw-r--r-- | lib/lsan/lsan_common.h | 5 | ||||
-rw-r--r-- | lib/lsan/lsan_common_mac.cc | 3 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc index 19e22fb61..25967c2d1 100644 --- a/lib/lsan/lsan_common.cc +++ b/lib/lsan/lsan_common.cc @@ -104,7 +104,7 @@ InternalMmapVector<RootRegion> const *GetRootRegions() { return root_regions; } void InitializeRootRegions() { CHECK(!root_regions); ALIGNED(64) static char placeholder[sizeof(InternalMmapVector<RootRegion>)]; - root_regions = new(placeholder) InternalMmapVector<RootRegion>(1); + root_regions = new (placeholder) InternalMmapVector<RootRegion>(); // NOLINT } const char *MaybeCallLsanDefaultOptions() { @@ -445,7 +445,7 @@ void ProcessPC(Frontier *frontier) { // Sets the appropriate tag on each chunk. static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads) { // Holds the flood fill frontier. - Frontier frontier(1); + Frontier frontier; ForEachChunk(CollectIgnoredCb, &frontier); ProcessGlobalRegions(&frontier); @@ -507,7 +507,7 @@ static void CollectLeaksCb(uptr chunk, void *arg) { } static void PrintMatchedSuppressions() { - InternalMmapVector<Suppression *> matched(1); + InternalMmapVector<Suppression *> matched; GetSuppressionContext()->GetMatched(&matched); if (!matched.size()) return; diff --git a/lib/lsan/lsan_common.h b/lib/lsan/lsan_common.h index f3863309d..2bffed4a5 100644 --- a/lib/lsan/lsan_common.h +++ b/lib/lsan/lsan_common.h @@ -95,7 +95,7 @@ struct LeakedObject { // Aggregates leaks by stack trace prefix. class LeakReport { public: - LeakReport() : next_id_(0), leaks_(1), leaked_objects_(1) {} + LeakReport() {} void AddLeakedChunk(uptr chunk, u32 stack_trace_id, uptr leaked_size, ChunkTag tag); void ReportTopLeaks(uptr max_leaks); @@ -103,12 +103,11 @@ class LeakReport { void ApplySuppressions(); uptr UnsuppressedLeakCount(); - private: void PrintReportForLeak(uptr index); void PrintLeakedObjectsForLeak(uptr index); - u32 next_id_; + u32 next_id_ = 0; InternalMmapVector<Leak> leaks_; InternalMmapVector<LeakedObject> leaked_objects_; }; diff --git a/lib/lsan/lsan_common_mac.cc b/lib/lsan/lsan_common_mac.cc index b8f8b25f6..2508c1dbd 100644 --- a/lib/lsan/lsan_common_mac.cc +++ b/lib/lsan/lsan_common_mac.cc @@ -119,7 +119,8 @@ void ProcessGlobalRegions(Frontier *frontier) { for (auto name : kSkippedSecNames) CHECK(ARRAY_SIZE(name) < kMaxSegName); MemoryMappingLayout memory_mapping(false); - InternalMmapVector<LoadedModule> modules(/*initial_capacity*/ 128); + InternalMmapVector<LoadedModule> modules; + modules.reserve(128); memory_mapping.DumpListOfModules(&modules); for (uptr i = 0; i < modules.size(); ++i) { // Even when global scanning is disabled, we still need to scan |