[compiler-rt] cf5c537 - [memprof] Fix RAII usage of SpinMutexLock, remove unused headers.

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 11:16:21 PST 2022


Author: Snehasish Kumar
Date: 2022-11-23T19:16:13Z
New Revision: cf5c53727bd47b4f66ea5e37039cb9a25d28b7c2

URL: https://github.com/llvm/llvm-project/commit/cf5c53727bd47b4f66ea5e37039cb9a25d28b7c2
DIFF: https://github.com/llvm/llvm-project/commit/cf5c53727bd47b4f66ea5e37039cb9a25d28b7c2.diff

LOG: [memprof] Fix RAII usage of SpinMutexLock, remove unused headers.

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

Added: 
    

Modified: 
    compiler-rt/lib/memprof/memprof_allocator.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/memprof/memprof_allocator.cpp b/compiler-rt/lib/memprof/memprof_allocator.cpp
index 6f8c61320aac1..4bd37460bebfc 100644
--- a/compiler-rt/lib/memprof/memprof_allocator.cpp
+++ b/compiler-rt/lib/memprof/memprof_allocator.cpp
@@ -28,10 +28,8 @@
 #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));
   }
 


        


More information about the llvm-commits mailing list