[compiler-rt] c81a322 - [compiler-rt] Fix -Wcast-qual after D147005 (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 16:41:31 PDT 2023


Author: Jie Fu
Date: 2023-04-04T07:40:34+08:00
New Revision: c81a322476a1b1c57ca72832e10c43663557e097

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

LOG: [compiler-rt] Fix -Wcast-qual after D147005 (NFC)

/home/jiefu/llvm-project/compiler-rt/lib/lsan/lsan_allocator.cpp:161:18: error: cast from 'const void *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
  return (void *)beg;
                 ^
1 error generated.

Added: 
    

Modified: 
    compiler-rt/lib/dfsan/dfsan_allocator.cpp
    compiler-rt/lib/lsan/lsan_allocator.cpp
    compiler-rt/lib/msan/msan_allocator.cpp
    compiler-rt/lib/tsan/rtl/tsan_mman.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/dfsan/dfsan_allocator.cpp b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
index cebf9983c9490..7ae6024fb2c9d 100644
--- a/compiler-rt/lib/dfsan/dfsan_allocator.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
@@ -177,7 +177,7 @@ void *DFsanCalloc(uptr nmemb, uptr size) {
 void *AllocationBegin(const void *p) {
   if (!p)
     return nullptr;
-  const void *beg = allocator.GetBlockBegin(p);
+  void *beg = allocator.GetBlockBegin(p);
   if (!beg)
     return nullptr;
   Metadata *b = (Metadata *)allocator.GetMetaData(beg);

diff  --git a/compiler-rt/lib/lsan/lsan_allocator.cpp b/compiler-rt/lib/lsan/lsan_allocator.cpp
index d50882657dc33..b0a54d7cd9bc5 100644
--- a/compiler-rt/lib/lsan/lsan_allocator.cpp
+++ b/compiler-rt/lib/lsan/lsan_allocator.cpp
@@ -148,7 +148,7 @@ void GetAllocatorCacheRange(uptr *begin, uptr *end) {
 void *GetMallocBegin(const void *p) {
   if (!p)
     return nullptr;
-  const void *beg = allocator.GetBlockBegin(p);
+  void *beg = allocator.GetBlockBegin(p);
   if (!beg)
     return nullptr;
   ChunkMetadata *m = Metadata(beg);

diff  --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp
index a760a434158a5..08ec3314b26e6 100644
--- a/compiler-rt/lib/msan/msan_allocator.cpp
+++ b/compiler-rt/lib/msan/msan_allocator.cpp
@@ -263,7 +263,7 @@ static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) {
 void *AllocationBegin(const void *p) {
   if (!p)
     return nullptr;
-  const void *beg = allocator.GetBlockBegin(p);
+  void *beg = allocator.GetBlockBegin(p);
   if (!beg)
     return nullptr;
   Metadata *b = (Metadata *)allocator.GetMetaData(beg);

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
index 9c548dfff91f3..3cc4d16955ede 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
@@ -355,7 +355,7 @@ void *user_pvalloc(ThreadState *thr, uptr pc, uptr sz) {
 void *user_alloc_begin(const void *p) {
   if (p == nullptr || !IsAppMem((uptr)p))
     return nullptr;
-  const void *beg = allocator()->GetBlockBegin(p);
+  void *beg = allocator()->GetBlockBegin(p);
   if (!beg)
     return nullptr;
 


        


More information about the llvm-commits mailing list