[llvm] r241958 - [IR] Switch static const to an enum to silence MSVC linker warnings

David Majnemer david.majnemer at gmail.com
Fri Jul 10 15:46:03 PDT 2015


Author: majnemer
Date: Fri Jul 10 17:46:02 2015
New Revision: 241958

URL: http://llvm.org/viewvc/llvm-project?rev=241958&view=rev
Log:
[IR] Switch static const to an enum to silence MSVC linker warnings

Integral class statics are handled oddly in MSVC, we don't need them
in this case, use an enum instead.

Modified:
    llvm/trunk/include/llvm/IR/Value.h
    llvm/trunk/lib/IR/Value.cpp

Modified: llvm/trunk/include/llvm/IR/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=241958&r1=241957&r2=241958&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Value.h (original)
+++ llvm/trunk/include/llvm/IR/Value.h Fri Jul 10 17:46:02 2015
@@ -104,8 +104,8 @@ protected:
   ///
   /// Note, this should *NOT* be used directly by any class other than User.
   /// User uses this value to find the Use list.
-  static const unsigned NumUserOperandsBits = 29;
-  unsigned NumUserOperands : 29;
+  enum : unsigned { NumUserOperandsBits = 29 };
+  unsigned NumUserOperands : NumUserOperandsBits;
 
   bool IsUsedByMD : 1;
   bool HasName : 1;

Modified: llvm/trunk/lib/IR/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=241958&r1=241957&r2=241958&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Value.cpp (original)
+++ llvm/trunk/lib/IR/Value.cpp Fri Jul 10 17:46:02 2015
@@ -39,8 +39,6 @@ using namespace llvm;
 //===----------------------------------------------------------------------===//
 //                                Value Class
 //===----------------------------------------------------------------------===//
-const unsigned Value::NumUserOperandsBits;
-
 static inline Type *checkType(Type *Ty) {
   assert(Ty && "Value defined with a null type: Error!");
   return Ty;





More information about the llvm-commits mailing list