[compiler-rt] d2df5ce - [NFC][asan] Remove redundant functions

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 19:41:17 PDT 2021


Author: Vitaly Buka
Date: 2021-09-30T19:38:23-07:00
New Revision: d2df5ce294cbaf3fe69e59e219cd8741e6185ed9

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

LOG: [NFC][asan] Remove redundant functions

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_allocator.cpp
    compiler-rt/lib/asan/asan_allocator.h
    compiler-rt/lib/asan/asan_debugging.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp
index 414fba3b427d4..268feac59ddda 100644
--- a/compiler-rt/lib/asan/asan_allocator.cpp
+++ b/compiler-rt/lib/asan/asan_allocator.cpp
@@ -908,13 +908,6 @@ AllocType AsanChunkView::GetAllocType() const {
   return (AllocType)chunk_->alloc_type;
 }
 
-static StackTrace GetStackTraceFromId(u32 id) {
-  CHECK(id);
-  StackTrace res = StackDepotGet(id);
-  CHECK(res.trace);
-  return res;
-}
-
 u32 AsanChunkView::GetAllocStackId() const {
   u32 tid = 0;
   u32 stack = 0;
@@ -931,14 +924,6 @@ u32 AsanChunkView::GetFreeStackId() const {
   return stack;
 }
 
-StackTrace AsanChunkView::GetAllocStack() const {
-  return GetStackTraceFromId(GetAllocStackId());
-}
-
-StackTrace AsanChunkView::GetFreeStack() const {
-  return GetStackTraceFromId(GetFreeStackId());
-}
-
 void InitializeAllocator(const AllocatorOptions &options) {
   instance.InitLinkerInitialized(options);
 }

diff  --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h
index 2963e979b55c0..27d826fb613ae 100644
--- a/compiler-rt/lib/asan/asan_allocator.h
+++ b/compiler-rt/lib/asan/asan_allocator.h
@@ -64,8 +64,6 @@ class AsanChunkView {
   bool Eq(const AsanChunkView &c) const { return chunk_ == c.chunk_; }
   u32 GetAllocStackId() const;
   u32 GetFreeStackId() const;
-  StackTrace GetAllocStack() const;
-  StackTrace GetFreeStack() const;
   AllocType GetAllocType() const;
   bool AddrIsInside(uptr addr, uptr access_size, sptr *offset) const {
     if (addr >= Beg() && (addr + access_size) <= End()) {

diff  --git a/compiler-rt/lib/asan/asan_debugging.cpp b/compiler-rt/lib/asan/asan_debugging.cpp
index c01360b52fc94..0b4bf52f2490a 100644
--- a/compiler-rt/lib/asan/asan_debugging.cpp
+++ b/compiler-rt/lib/asan/asan_debugging.cpp
@@ -19,6 +19,7 @@
 #include "asan_mapping.h"
 #include "asan_report.h"
 #include "asan_thread.h"
+#include "sanitizer_common/sanitizer_stackdepot.h"
 
 namespace {
 using namespace __asan;
@@ -54,11 +55,11 @@ uptr AsanGetStack(uptr addr, uptr *trace, u32 size, u32 *thread_id,
   StackTrace stack(nullptr, 0);
   if (alloc_stack) {
     if (chunk.AllocTid() == kInvalidTid) return 0;
-    stack = chunk.GetAllocStack();
+    stack = StackDepotGet(chunk.GetAllocStackId());
     if (thread_id) *thread_id = chunk.AllocTid();
   } else {
     if (chunk.FreeTid() == kInvalidTid) return 0;
-    stack = chunk.GetFreeStack();
+    stack = StackDepotGet(chunk.GetFreeStackId());
     if (thread_id) *thread_id = chunk.FreeTid();
   }
 


        


More information about the llvm-commits mailing list