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

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 24 11:10:06 PDT 2016


Thanks Duncan! 
I was puzzled by this failure...

-- 
Mehdi


> On Apr 24, 2016, at 7:25 AM, Duncan P. N. Exon Smith via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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; }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list