[compiler-rt] 39b8a27 - [sanitizer] Simplify with GET_CALLER_PC_BP. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 4 11:30:20 PST 2023
Author: Fangrui Song
Date: 2023-02-04T11:30:14-08:00
New Revision: 39b8a27132833a7c91059e26af48f20b2e874b61
URL: https://github.com/llvm/llvm-project/commit/39b8a27132833a7c91059e26af48f20b2e874b61
DIFF: https://github.com/llvm/llvm-project/commit/39b8a27132833a7c91059e26af48f20b2e874b61.diff
LOG: [sanitizer] Simplify with GET_CALLER_PC_BP. NFC
Added:
Modified:
compiler-rt/lib/dfsan/dfsan.cpp
compiler-rt/lib/msan/msan.cpp
compiler-rt/lib/msan/msan_interceptors.cpp
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/dfsan/dfsan.cpp b/compiler-rt/lib/dfsan/dfsan.cpp
index faf5a6619c26c..a579c9e534443 100644
--- a/compiler-rt/lib/dfsan/dfsan.cpp
+++ b/compiler-rt/lib/dfsan/dfsan.cpp
@@ -197,8 +197,7 @@ static dfsan_origin GetOriginIfTainted(uptr addr, uptr size) {
#define PRINT_CALLER_STACK_TRACE \
{ \
- GET_CALLER_PC_BP_SP; \
- (void)sp; \
+ GET_CALLER_PC_BP; \
GET_STORE_STACK_TRACE_PC_BP(pc, bp) \
stack.Print(); \
}
@@ -381,8 +380,7 @@ static void SetOrigin(const void *dst, uptr size, u32 origin) {
}
#define RET_CHAIN_ORIGIN(id) \
- GET_CALLER_PC_BP_SP; \
- (void)sp; \
+ GET_CALLER_PC_BP; \
GET_STORE_STACK_TRACE_PC_BP(pc, bp); \
return ChainOrigin(id, &stack);
@@ -567,8 +565,7 @@ void SetShadow(dfsan_label label, void *addr, uptr size, dfsan_origin origin) {
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_maybe_store_origin(
dfsan_label s, void *p, uptr size, dfsan_origin o) {
if (UNLIKELY(s)) {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
GET_STORE_STACK_TRACE_PC_BP(pc, bp);
SetOrigin(p, size, ChainOrigin(o, &stack));
}
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index 3e3bc3cb979fc..987c5560825d9 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -345,8 +345,7 @@ using namespace __msan;
#define MSAN_MAYBE_WARNING(type, size) \
void __msan_maybe_warning_##size(type s, u32 o) { \
- GET_CALLER_PC_BP_SP; \
- (void) sp; \
+ GET_CALLER_PC_BP; \
if (UNLIKELY(s)) { \
PrintWarningWithOrigin(pc, bp, o); \
if (__msan::flags()->halt_on_error) { \
@@ -365,8 +364,7 @@ MSAN_MAYBE_WARNING(u64, 8)
void __msan_maybe_store_origin_##size(type s, void *p, u32 o) { \
if (UNLIKELY(s)) { \
if (__msan_get_track_origins() > 1) { \
- GET_CALLER_PC_BP_SP; \
- (void) sp; \
+ GET_CALLER_PC_BP; \
GET_STORE_STACK_TRACE_PC_BP(pc, bp); \
o = ChainOrigin(o, &stack); \
} \
@@ -380,8 +378,7 @@ MSAN_MAYBE_STORE_ORIGIN(u32, 4)
MSAN_MAYBE_STORE_ORIGIN(u64, 8)
void __msan_warning() {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
PrintWarningWithOrigin(pc, bp, 0);
if (__msan::flags()->halt_on_error) {
if (__msan::flags()->print_stats)
@@ -392,8 +389,7 @@ void __msan_warning() {
}
void __msan_warning_noreturn() {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
PrintWarningWithOrigin(pc, bp, 0);
if (__msan::flags()->print_stats)
ReportStats();
@@ -402,8 +398,7 @@ void __msan_warning_noreturn() {
}
void __msan_warning_with_origin(u32 origin) {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
PrintWarningWithOrigin(pc, bp, origin);
if (__msan::flags()->halt_on_error) {
if (__msan::flags()->print_stats)
@@ -414,8 +409,7 @@ void __msan_warning_with_origin(u32 origin) {
}
void __msan_warning_with_origin_noreturn(u32 origin) {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
PrintWarningWithOrigin(pc, bp, origin);
if (__msan::flags()->print_stats)
ReportStats();
@@ -513,8 +507,7 @@ void __msan_set_expect_umr(int expect_umr) {
if (expect_umr) {
msan_expected_umr_found = 0;
} else if (!msan_expected_umr_found) {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
GET_FATAL_STACK_TRACE_PC_BP(pc, bp);
ReportExpectedUMRNotFound(&stack);
Die();
@@ -562,8 +555,7 @@ void __msan_check_mem_is_initialized(const void *x, uptr size) {
if (offset < 0)
return;
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
ReportUMRInsideAddressRange(__func__, x, size, offset);
__msan::PrintWarningWithOrigin(pc, bp,
__msan_get_origin(((const char *)x) + offset));
@@ -622,8 +614,7 @@ void __msan_set_alloca_origin_no_descr(void *a, uptr size, u32 *id_ptr) {
}
u32 __msan_chain_origin(u32 id) {
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
GET_STORE_STACK_TRACE_PC_BP(pc, bp);
return ChainOrigin(id, &stack);
}
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
index 058c10a194242..757dc46739bea 100644
--- a/compiler-rt/lib/msan/msan_interceptors.cpp
+++ b/compiler-rt/lib/msan/msan_interceptors.cpp
@@ -93,8 +93,7 @@ struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {
if (__msan::IsInSymbolizerOrUnwider()) \
break; \
if (__offset >= 0 && __msan::flags()->report_umrs) { \
- GET_CALLER_PC_BP_SP; \
- (void)sp; \
+ GET_CALLER_PC_BP; \
ReportUMRInsideAddressRange(__func__, x, n, __offset); \
__msan::PrintWarningWithOrigin( \
pc, bp, __msan_get_origin((const char *)x + __offset)); \
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index d5c028e3640d2..73915715c5ba2 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -107,8 +107,7 @@ void ReportMmapWriteExec(int prot, int flags) {
stack->Reset();
uptr top = 0;
uptr bottom = 0;
- GET_CALLER_PC_BP_SP;
- (void)sp;
+ GET_CALLER_PC_BP;
bool fast = common_flags()->fast_unwind_on_fatal;
if (StackTrace::WillUseFastUnwind(fast)) {
GetThreadStackTopAndBottom(false, &top, &bottom);
More information about the llvm-commits
mailing list