[compiler-rt] 870eee4 - [NFC][asan] Use %p to print addresses (#98575)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 22:35:31 PDT 2024


Author: Vitaly Buka
Date: 2024-07-11T22:35:27-07:00
New Revision: 870eee464b336cc42e3e1883e5402675be180eec

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

LOG: [NFC][asan] Use %p to print addresses (#98575)

Co-authored-by: vporpo <vporpodas at google.com>

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_descriptions.cpp
    compiler-rt/lib/asan/asan_rtl.cpp
    compiler-rt/test/asan/TestCases/debug_mapping.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp
index 05a277cfa0a84..1c2f20a76343b 100644
--- a/compiler-rt/lib/asan/asan_descriptions.cpp
+++ b/compiler-rt/lib/asan/asan_descriptions.cpp
@@ -292,7 +292,7 @@ static void DescribeAddressRelativeToGlobal(uptr addr, uptr access_size,
   str.AppendF(" global variable '%s' defined in '",
               MaybeDemangleGlobalName(g.name));
   PrintGlobalLocation(&str, g, /*print_module_name=*/false);
-  str.AppendF("' (0x%zx) of size %zu\n", g.beg, g.size);
+  str.AppendF("' (%p) of size %zu\n", (void *)g.beg, g.size);
   str.Append(d.Default());
   PrintGlobalNameIfASCII(&str, g);
   Printf("%s", str.data());

diff  --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp
index c484e086a5ef7..d42a75e9e5211 100644
--- a/compiler-rt/lib/asan/asan_rtl.cpp
+++ b/compiler-rt/lib/asan/asan_rtl.cpp
@@ -382,7 +382,7 @@ void PrintAddressSpaceLayout() {
 
   Printf("SHADOW_SCALE: %d\n", (int)ASAN_SHADOW_SCALE);
   Printf("SHADOW_GRANULARITY: %d\n", (int)ASAN_SHADOW_GRANULARITY);
-  Printf("SHADOW_OFFSET: 0x%zx\n", (uptr)ASAN_SHADOW_OFFSET);
+  Printf("SHADOW_OFFSET: %p\n", (void *)ASAN_SHADOW_OFFSET);
   CHECK(ASAN_SHADOW_SCALE >= 3 && ASAN_SHADOW_SCALE <= 7);
   if (kMidMemBeg)
     CHECK(kMidShadowBeg > kLowShadowEnd &&

diff  --git a/compiler-rt/test/asan/TestCases/debug_mapping.cpp b/compiler-rt/test/asan/TestCases/debug_mapping.cpp
index 40083f02853fc..9c8ab468bedd9 100644
--- a/compiler-rt/test/asan/TestCases/debug_mapping.cpp
+++ b/compiler-rt/test/asan/TestCases/debug_mapping.cpp
@@ -14,7 +14,7 @@
 
 // printed because of verbosity=1
 // CHECK: SHADOW_SCALE: [[SCALE:[0-9]+]]
-// CHECK: SHADOW_OFFSET: [[OFFSET:0x[0-9a-f]+]]
+// CHECK: SHADOW_OFFSET: 0x{{0*}}[[OFFSET:[0-9a-f]+]]
 
 int main() {
   size_t scale, offset;
@@ -24,7 +24,7 @@ int main() {
   fprintf(stderr, "offset: 0x" PTR "\n", (void*)offset);
 
   // CHECK: scale: [[SCALE]]
-  // CHECK: offset: [[OFFSET]]
+  // CHECK: offset: 0x{{0*}}[[OFFSET]]
 
   return 0;
 }


        


More information about the llvm-commits mailing list