]> granicus.if.org Git - clang/commitdiff
Fix the type of 1<<31 integer constants.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 24 Sep 2018 17:51:15 +0000 (17:51 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 24 Sep 2018 17:51:15 +0000 (17:51 +0000)
Shifting into the sign bit is technically undefined behavior. No known
compiler exploits it though.

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

include/clang/Basic/SourceManager.h
lib/CodeGen/CGBlocks.h

index af7dbbc13ca7b14586b71672d08515abe6ce0e5a..c5a53960b363fa8e2caef9878b411a36bffe26ab 100644 (file)
@@ -449,7 +449,7 @@ namespace SrcMgr {
     }
 
     static SLocEntry get(unsigned Offset, const FileInfo &FI) {
-      assert(!(Offset & (1 << 31)) && "Offset is too large");
+      assert(!(Offset & (1u << 31)) && "Offset is too large");
       SLocEntry E;
       E.Offset = Offset;
       E.IsExpansion = false;
@@ -458,7 +458,7 @@ namespace SrcMgr {
     }
 
     static SLocEntry get(unsigned Offset, const ExpansionInfo &Expansion) {
-      assert(!(Offset & (1 << 31)) && "Offset is too large");
+      assert(!(Offset & (1u << 31)) && "Offset is too large");
       SLocEntry E;
       E.Offset = Offset;
       E.IsExpansion = true;
index c802948af06088e97637253ede4f1353ca3608f1..3f9fc16d9b101ec54d046bf46a6b07b8d45d705b 100644 (file)
@@ -60,7 +60,7 @@ enum BlockLiteralFlags {
   BLOCK_IS_GLOBAL =         (1 << 28),
   BLOCK_USE_STRET =         (1 << 29),
   BLOCK_HAS_SIGNATURE  =    (1 << 30),
-  BLOCK_HAS_EXTENDED_LAYOUT = (1 << 31)
+  BLOCK_HAS_EXTENDED_LAYOUT = (1u << 31)
 };
 class BlockFlags {
   uint32_t flags;