[compiler-rt] 2b0bfb6 - [NFC][Asan] Use GET_CURRENT_FRAME instead of local var
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 18:54:34 PDT 2023
Author: Vitaly Buka
Date: 2023-08-08T18:48:54-07:00
New Revision: 2b0bfb6928ef070f3e79dfee0b34a2895a414d59
URL: https://github.com/llvm/llvm-project/commit/2b0bfb6928ef070f3e79dfee0b34a2895a414d59
DIFF: https://github.com/llvm/llvm-project/commit/2b0bfb6928ef070f3e79dfee0b34a2895a414d59.diff
LOG: [NFC][Asan] Use GET_CURRENT_FRAME instead of local var
Added:
Modified:
compiler-rt/lib/asan/asan_fake_stack.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_fake_stack.cpp b/compiler-rt/lib/asan/asan_fake_stack.cpp
index 74a039b6579856..72d1920579e997 100644
--- a/compiler-rt/lib/asan/asan_fake_stack.cpp
+++ b/compiler-rt/lib/asan/asan_fake_stack.cpp
@@ -205,11 +205,12 @@ static FakeStack *GetFakeStackFastAlways() {
static ALWAYS_INLINE uptr OnMalloc(uptr class_id, uptr size) {
FakeStack *fs = GetFakeStackFast();
- if (!fs) return 0;
- uptr local_stack;
- uptr real_stack = reinterpret_cast<uptr>(&local_stack);
- FakeFrame *ff = fs->Allocate(fs->stack_size_log(), class_id, real_stack);
- if (!ff) return 0; // Out of fake stack.
+ if (!fs)
+ return 0;
+ FakeFrame *ff =
+ fs->Allocate(fs->stack_size_log(), class_id, GET_CURRENT_FRAME());
+ if (!ff)
+ return 0; // Out of fake stack.
uptr ptr = reinterpret_cast<uptr>(ff);
SetShadow(ptr, size, class_id, 0);
return ptr;
@@ -219,9 +220,8 @@ static ALWAYS_INLINE uptr OnMallocAlways(uptr class_id, uptr size) {
FakeStack *fs = GetFakeStackFastAlways();
if (!fs)
return 0;
- uptr local_stack;
- uptr real_stack = reinterpret_cast<uptr>(&local_stack);
- FakeFrame *ff = fs->Allocate(fs->stack_size_log(), class_id, real_stack);
+ FakeFrame *ff =
+ fs->Allocate(fs->stack_size_log(), class_id, GET_CURRENT_FRAME());
if (!ff)
return 0; // Out of fake stack.
uptr ptr = reinterpret_cast<uptr>(ff);
More information about the llvm-commits
mailing list