[memprof] Fix RAII usage of SpinMutexLock, remove unused headers.
authorSnehasish Kumar <snehasishk@google.com>
Wed, 23 Nov 2022 19:00:03 +0000 (19:00 +0000)
committerSnehasish Kumar <snehasishk@google.com>
Wed, 23 Nov 2022 19:16:13 +0000 (19:16 +0000)
For the RAII lock usage we need to create a local var. There were some headers which clang-tidy identified as unused.

Reviewed By: tejohnson

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

compiler-rt/lib/memprof/memprof_allocator.cpp

index 6f8c613..4bd3746 100644 (file)
 #include "sanitizer_common/sanitizer_flags.h"
 #include "sanitizer_common/sanitizer_interface_internal.h"
 #include "sanitizer_common/sanitizer_internal_defs.h"
-#include "sanitizer_common/sanitizer_list.h"
 #include "sanitizer_common/sanitizer_procmaps.h"
 #include "sanitizer_common/sanitizer_stackdepot.h"
-#include "sanitizer_common/sanitizer_vector.h"
 
 #include <sched.h>
 #include <time.h>
@@ -279,7 +277,7 @@ struct Allocator {
 
   static void PrintCallback(const uptr Key, LockedMemInfoBlock *const &Value,
                             void *Arg) {
-    SpinMutexLock(&Value->mutex);
+    SpinMutexLock l(&Value->mutex);
     Print(Value->mib, Key, bool(Arg));
   }