[llvm] r241945 - [MC] Switch static const to an enum to silence MSVC linker warnings

David Majnemer david.majnemer at gmail.com
Fri Jul 10 14:50:04 PDT 2015


Author: majnemer
Date: Fri Jul 10 16:50:04 2015
New Revision: 241945

URL: http://llvm.org/viewvc/llvm-project?rev=241945&view=rev
Log:
[MC] 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/MC/MCSymbol.h
    llvm/trunk/lib/MC/MCSymbol.cpp

Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=241945&r1=241944&r2=241945&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Fri Jul 10 16:50:04 2015
@@ -114,12 +114,12 @@ protected:
   /// The alignment is stored as log2(align) + 1.  This allows all values from
   /// 0 to 2^31 to be stored which is every power of 2 representable by an
   /// unsigned.
-  static const unsigned NumCommonAlignmentBits = 5;
+  enum : unsigned { NumCommonAlignmentBits = 5 };
   unsigned CommonAlignLog2 : NumCommonAlignmentBits;
 
   /// The Flags field is used by object file implementations to store
   /// additional per symbol information which is not easily classified.
-  static const unsigned NumFlagsBits = 16;
+  enum : unsigned { NumFlagsBits = 16 };
   mutable uint32_t Flags : NumFlagsBits;
 
   /// Index field, for use by the object file implementation.

Modified: llvm/trunk/lib/MC/MCSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=241945&r1=241944&r2=241945&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbol.cpp Fri Jul 10 16:50:04 2015
@@ -19,9 +19,6 @@ using namespace llvm;
 // Sentinel value for the absolute pseudo section.
 MCSection *MCSymbol::AbsolutePseudoSection = reinterpret_cast<MCSection *>(1);
 
-const unsigned MCSymbol::NumCommonAlignmentBits;
-const unsigned MCSymbol::NumFlagsBits;
-
 void *MCSymbol::operator new(size_t s, const StringMapEntry<bool> *Name,
                              MCContext &Ctx) {
   // We may need more space for a Name to account for alignment.  So allocate





More information about the llvm-commits mailing list