[compiler-rt] 515e19a - Fix errors/warnings in scudo build.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 08:37:53 PST 2020


Author: Peter Collingbourne
Date: 2020-02-11T08:37:37-08:00
New Revision: 515e19ae7b5f8be51686def4b7a64e917125d8e0

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

LOG: Fix errors/warnings in scudo build.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/size_class_map.h
    compiler-rt/lib/scudo/standalone/tsd_shared.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/size_class_map.h b/compiler-rt/lib/scudo/standalone/size_class_map.h
index 46f53ae51fba..151f4f95f541 100644
--- a/compiler-rt/lib/scudo/standalone/size_class_map.h
+++ b/compiler-rt/lib/scudo/standalone/size_class_map.h
@@ -24,7 +24,7 @@ inline uptr scaledLog2(uptr Size, uptr ZeroLog, uptr LogBits) {
 
 template <typename Config> struct SizeClassMapBase {
   static u32 getMaxCachedHint(uptr Size) {
-    DCHECK_LE(Size, MaxSize);
+    DCHECK_LE(Size, (1UL << Config::MaxSizeLog) + Chunk::getHeaderSize());
     DCHECK_NE(Size, 0);
     u32 N;
     // Force a 32-bit division if the template parameters allow for it.
@@ -119,9 +119,9 @@ class TableSizeClassMap : public SizeClassMapBase<Config> {
     constexpr static u8 computeClassId(uptr Size) {
       for (uptr i = 0; i != ClassesSize; ++i) {
         if (Size <= Config::Classes[i])
-          return i + 1;
+          return static_cast<u8>(i + 1);
       }
-      return -1;
+      return static_cast<u8>(-1);
     }
 
     constexpr static uptr getTableSize() {

diff  --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 1626732c70f4..cf5453d20208 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -79,7 +79,7 @@ template <class Allocator, u32 MaxTSDCount> struct TSDRegistrySharedT {
   }
 
   void enable() {
-    for (s32 I = NumberOfTSDs - 1; I >= 0; I--)
+    for (s32 I = static_cast<s32>(NumberOfTSDs - 1); I >= 0; I--)
       TSDs[I].unlock();
     Mutex.unlock();
   }


        


More information about the llvm-commits mailing list