[llvm] r267342 - ModuleSummaryIndex: Avoid enum bitfields for MSVC portability

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 24 07:25:37 PDT 2016


Author: dexonsmith
Date: Sun Apr 24 09:25:37 2016
New Revision: 267342

URL: http://llvm.org/viewvc/llvm-project?rev=267342&view=rev
Log:
ModuleSummaryIndex: Avoid enum bitfields for MSVC portability

Enum bitfields have crazy portability issues with MSVC.  Use unsigned
instead of LinkageTypes here in the ModuleSummaryIndex to address
Takumi's concerns from r267335.

Modified:
    llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h

Modified: llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h?rev=267342&r1=267341&r2=267342&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h (original)
+++ llvm/trunk/include/llvm/IR/ModuleSummaryIndex.h Sun Apr 24 09:25:37 2016
@@ -101,7 +101,7 @@ public:
     /// index, to disambiguate from other values with the same name.
     /// In the future this will be used to update and optimize linkage
     /// types based on global summary-based analysis.
-    GlobalValue::LinkageTypes Linkage : 4;
+    unsigned Linkage : 4;
 
     /// Indicate if the global value is located in a specific section.
     unsigned HasSection : 1;
@@ -167,7 +167,9 @@ public:
   GVFlags flags() { return Flags; }
 
   /// Return linkage type recorded for this global value.
-  GlobalValue::LinkageTypes linkage() const { return Flags.Linkage; }
+  GlobalValue::LinkageTypes linkage() const {
+    return static_cast<GlobalValue::LinkageTypes>(Flags.Linkage);
+  }
 
   /// Return true if this global value is located in a specific section.
   bool hasSection() const { return Flags.HasSection; }




More information about the llvm-commits mailing list