[ASan] change interface of GetAccumulatedStats() function to prevent Clang from inser...
authorAlexey Samsonov <samsonov@google.com>
Mon, 19 Nov 2012 10:25:17 +0000 (10:25 +0000)
committerAlexey Samsonov <samsonov@google.com>
Mon, 19 Nov 2012 10:25:17 +0000 (10:25 +0000)
llvm-svn: 168305

compiler-rt/lib/asan/asan_stats.cc
compiler-rt/lib/asan/asan_thread_registry.cc
compiler-rt/lib/asan/asan_thread_registry.h

index 189315b..4f39ba6 100644 (file)
@@ -56,7 +56,8 @@ void AsanStats::Print() {
 static AsanLock print_lock(LINKER_INITIALIZED);
 
 static void PrintAccumulatedStats() {
-  AsanStats stats = asanThreadRegistry().GetAccumulatedStats();
+  AsanStats stats;
+  asanThreadRegistry().GetAccumulatedStats(&stats);
   // Use lock to keep reports from mixing up.
   ScopedLock lock(&print_lock);
   stats.Print();
index 4bf63cd..0e07e19 100644 (file)
@@ -104,10 +104,10 @@ AsanStats &AsanThreadRegistry::GetCurrentThreadStats() {
   return (t) ? t->stats() : main_thread_.stats();
 }
 
-AsanStats AsanThreadRegistry::GetAccumulatedStats() {
+void AsanThreadRegistry::GetAccumulatedStats(AsanStats *stats) {
   ScopedLock lock(&mu_);
   UpdateAccumulatedStatsUnlocked();
-  return accumulated_stats_;
+  internal_memcpy(stats, &accumulated_stats_, sizeof(accumulated_stats_));
 }
 
 uptr AsanThreadRegistry::GetCurrentAllocatedBytes() {
index 3ad55f5..2056e73 100644 (file)
@@ -47,9 +47,9 @@ class AsanThreadRegistry {
   // Returns stats for GetCurrent(), or stats for
   // T0 if GetCurrent() returns 0.
   AsanStats &GetCurrentThreadStats();
-  // Flushes all thread-local stats to accumulated stats, and returns
+  // Flushes all thread-local stats to accumulated stats, and makes
   // a copy of accumulated stats.
-  AsanStats GetAccumulatedStats();
+  void GetAccumulatedStats(AsanStats *stats);
   uptr GetCurrentAllocatedBytes();
   uptr GetHeapSize();
   uptr GetFreeBytes();