From: Reid Kleckner Date: Fri, 31 Oct 2014 23:33:56 +0000 (+0000) Subject: Silence a warning from MSVC "14" by making an enum unsigned X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32ec8a0e2595cfc560b98e330b84d8f0df546296;p=clang Silence a warning from MSVC "14" by making an enum unsigned 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 --- diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 2c7783234b..a683e88783 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -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(Kind); } }; diff --git a/lib/CodeGen/EHScopeStack.h b/lib/CodeGen/EHScopeStack.h index b2491966cb..e695848409 100644 --- a/lib/CodeGen/EHScopeStack.h +++ b/lib/CodeGen/EHScopeStack.h @@ -74,7 +74,7 @@ template struct DominatingPointer : InvariantValue {}; template struct DominatingValue : DominatingPointer {}; -enum CleanupKind { +enum CleanupKind : unsigned { EHCleanup = 0x1, NormalCleanup = 0x2, NormalAndEHCleanup = EHCleanup | NormalCleanup,