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.

llvm-svn: 221019

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

index 2c77832..a683e88 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 b249196..e695848 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,