From 7ebb7ed7d0954bf7d82bf3fd60b8988d8929f42f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 10 Jul 2015 21:50:04 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241945 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSymbol.h | 4 ++-- lib/MC/MCSymbol.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index 17e6b857cf2..b2910dfccd6 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -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. diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index affc57471fd..125380a9d14 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -19,9 +19,6 @@ using namespace llvm; // Sentinel value for the absolute pseudo section. MCSection *MCSymbol::AbsolutePseudoSection = reinterpret_cast(1); -const unsigned MCSymbol::NumCommonAlignmentBits; -const unsigned MCSymbol::NumFlagsBits; - void *MCSymbol::operator new(size_t s, const StringMapEntry *Name, MCContext &Ctx) { // We may need more space for a Name to account for alignment. So allocate