[PATCH] MC: simplify object file selection for Windows

Saleem Abdulrasool abdulras at fb.com
Tue Mar 4 11:50:47 PST 2014


Hi majnemer,

Windows always uses COFF unless Windows ELF is in use.  Rather than checking if
Windows, MinGW, or Cygwin is being targeted, just check if the target OS is
windows and that it is not an ELF environment.

http://llvm-reviews.chandlerc.com/D2945

Files:
  lib/MC/MCObjectFileInfo.cpp

Index: lib/MC/MCObjectFileInfo.cpp
===================================================================
--- lib/MC/MCObjectFileInfo.cpp
+++ lib/MC/MCObjectFileInfo.cpp
@@ -739,10 +739,9 @@
       (T.isOSDarwin() || T.getEnvironment() == Triple::MachO)) {
     Env = IsMachO;
     InitMachOMCObjectFileInfo(T);
-  } else if ((Arch == Triple::x86 || Arch == Triple::x86_64) &&
-             (T.getEnvironment() != Triple::ELF) &&
-             (T.getOS() == Triple::MinGW32 || T.getOS() == Triple::Cygwin ||
-              T.getOS() == Triple::Win32)) {
+  } else if (T.isOSWindows() && T.getEnvironment() != Triple::ELF) {
+    assert((Arch == Triple::x86 || Arch == Triple::x86_64) &&
+           "expected x86 or x86_64");
     Env = IsCOFF;
     InitCOFFMCObjectFileInfo(T);
   } else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2945.1.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140304/118141ea/attachment.bin>


More information about the llvm-commits mailing list