]> granicus.if.org Git - clang/commitdiff
Log2_32 returns an unsigned. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Oct 2019 11:49:32 +0000 (11:49 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Oct 2019 11:49:32 +0000 (11:49 +0000)
Silences clang static analyzer warning about out of bounds (negative) shifts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373451 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCGNU.cpp

index ee5c12aa35bd76540a249e59ecd4ba5397e3249e..ee0fd184c64d4383695b4f3743b8d7c04e114f10 100644 (file)
@@ -1854,7 +1854,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
         ivarBuilder.addInt(Int32Ty,
             CGM.getContext().getTypeSizeInChars(ivarTy).getQuantity());
         // Alignment will be stored as a base-2 log of the alignment.
-        int align = llvm::Log2_32(Context.getTypeAlignInChars(ivarTy).getQuantity());
+        unsigned align =
+            llvm::Log2_32(Context.getTypeAlignInChars(ivarTy).getQuantity());
         // Objects that require more than 2^64-byte alignment should be impossible!
         assert(align < 64);
         // uint32_t flags;