[llvm] r239357 - [MC] Use unsigned for the Kind bitfield in MCSymbol

Reid Kleckner reid at kleckner.net
Mon Jun 8 15:12:44 PDT 2015


Author: rnk
Date: Mon Jun  8 17:12:44 2015
New Revision: 239357

URL: http://llvm.org/viewvc/llvm-project?rev=239357&view=rev
Log:
[MC] Use unsigned for the Kind bitfield in MCSymbol

Fixes most of the test suite on Windows with clang-cl.

I'm not sure why the test suite was passing with MSVC 2013. Maybe they
changed their behavior and we are emulating their old sign extension
behavior. I think this deserves more investigation, but I want to green
the bot first.

Modified:
    llvm/trunk/include/llvm/MC/MCSymbol.h

Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=239357&r1=239356&r2=239357&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Mon Jun  8 17:12:44 2015
@@ -90,7 +90,9 @@ protected:
   /// This symbol is private extern.
   mutable unsigned IsPrivateExtern : 1;
 
-  SymbolKind Kind : 2;
+  /// LLVM RTTI discriminator. This is actually a SymbolKind enumerator, but is
+  /// unsigned to avoid sign extension and achieve better bitpacking with MSVC.
+  unsigned Kind : 2;
 
   /// Index field, for use by the object file implementation.
   mutable uint32_t Index = 0;





More information about the llvm-commits mailing list