[lld] r331534 - [PPC64] Remove support for ELF V1 ABI in LLD - buildbot fix

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 15:10:25 PDT 2018


I think you can still use Config->IsLE. If you use Config->EKind and a
switch-case, you needed to have a `default` clause like this. So, I'd
suggest something like

  if (Config->IsLE)
    EFlags = cast<>...
  else
    EFlags = cast<>...

On Fri, May 4, 2018 at 9:07 AM Zaara Syeda via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: syzaara
> Date: Fri May  4 09:04:04 2018
> New Revision: 331534
>
> URL: http://llvm.org/viewvc/llvm-project?rev=331534&view=rev
> Log:
> [PPC64] Remove support for ELF V1 ABI in LLD - buildbot fix
>
> Fix buildbot error, failure to build with msvc due to error C2446
> Use switch instead of ternary operator.
>
> Differential Revision: https://reviews.llvm.org/D46316
>
> Modified:
>     lld/trunk/ELF/Arch/PPC64.cpp
>
> Modified: lld/trunk/ELF/Arch/PPC64.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=331534&r1=331533&r2=331534&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Arch/PPC64.cpp (original)
> +++ lld/trunk/ELF/Arch/PPC64.cpp Fri May  4 09:04:04 2018
> @@ -97,10 +97,17 @@ PPC64::PPC64() {
>  static uint32_t getEFlags(InputFile *File) {
>    // Get the e_flag from the input file and issue an error if incompatible
>    // e_flag encountered.
> -
> -  uint32_t EFlags = Config->IsLE ?
> -    cast<ObjFile<ELF64LE>>(File)->getObj().getHeader()->e_flags :
> -    cast<ObjFile<ELF64BE>>(File)->getObj().getHeader()->e_flags;
> +  uint32_t EFlags;
> +  switch (Config->EKind) {
> +  case ELF64BEKind:
> +    EFlags = cast<ObjFile<ELF64BE>>(File)->getObj().getHeader()->e_flags;
> +    break;
> +  case ELF64LEKind:
> +    EFlags = cast<ObjFile<ELF64LE>>(File)->getObj().getHeader()->e_flags;
> +    break;
> +  default:
> +    llvm_unreachable("unknown Config->EKind");
> +  }
>    if (EFlags > 2) {
>      error("incompatible e_flags: " +  toString(File));
>      return 0;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/27681dd0/attachment.html>


More information about the llvm-commits mailing list