]> granicus.if.org Git - clang/commitdiff
Silence a warning from MSVC "14" by making an enum unsigned
authorReid Kleckner <reid@kleckner.net>
Fri, 31 Oct 2014 23:33:56 +0000 (23:33 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 31 Oct 2014 23:33:56 +0000 (23:33 +0000)
It says there is a narrowing conversion when we assign it to an unsigned
3 bit bitfield.

Also, use unsigned instead of size_t for the Size field of the struct in
question. Otherwise they won't run together in MSVC or clang-cl.

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

lib/CodeGen/CodeGenFunction.h
lib/CodeGen/EHScopeStack.h

index 2c7783234b940e5488e3c0f577c5bbcacb64790a..a683e88783f3a1799ff6a7b339f5c00de8cf2abf 100644 (file)
@@ -289,11 +289,11 @@ public:
   /// Header for data within LifetimeExtendedCleanupStack.
   struct LifetimeExtendedCleanupHeader {
     /// The size of the following cleanup object.
-    size_t Size : 29;
+    unsigned Size : 29;
     /// The kind of cleanup to push: a value from the CleanupKind enumeration.
     unsigned Kind : 3;
 
-    size_t getSize() const { return Size; }
+    size_t getSize() const { return size_t(Size); }
     CleanupKind getKind() const { return static_cast<CleanupKind>(Kind); }
   };
 
index b2491966cb88ea1047c3ba3e81a3de7f12aa722c..e69584840990643d247e03c3de3b8592edb384bf 100644 (file)
@@ -74,7 +74,7 @@ template <class T> struct DominatingPointer<T,false> : InvariantValue<T*> {};
 
 template <class T> struct DominatingValue<T*> : DominatingPointer<T> {};
 
-enum CleanupKind {
+enum CleanupKind : unsigned {
   EHCleanup = 0x1,
   NormalCleanup = 0x2,
   NormalAndEHCleanup = EHCleanup | NormalCleanup,