Fix integer unsigned behavior in clang due to signed left shift overflow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162626 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h
index 392dad9..a6aa40b 100644
--- a/include/clang/AST/VTableBuilder.h
+++ b/include/clang/AST/VTableBuilder.h
@@ -147,9 +147,10 @@
     assert((ComponentKind == CK_VCallOffset ||
             ComponentKind == CK_VBaseOffset ||
             ComponentKind == CK_OffsetToTop) && "Invalid component kind!");
-    assert(Offset.getQuantity() <= ((1LL << 56) - 1) && "Offset is too big!");
+    assert(Offset.getQuantity() < (1LL << 56) && "Offset is too big!");
+    assert(Offset.getQuantity() >= -(1LL << 56) && "Offset is too small!");
 
-    Value = ((Offset.getQuantity() << 3) | ComponentKind);
+    Value = (uint64_t(Offset.getQuantity()) << 3) | ComponentKind;
   }
 
   VTableComponent(Kind ComponentKind, uintptr_t Ptr) {
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index eca9f5b..e46423b 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -886,7 +886,7 @@
       Offset = Layout.getBaseClassOffset(BaseDecl);
     };
     
-    OffsetFlags = Offset.getQuantity() << 8;
+    OffsetFlags = uint64_t(Offset.getQuantity()) << 8;
     
     // The low-order byte of __offset_flags contains flags, as given by the 
     // masks from the enumeration __offset_flags_masks.