r204978 - Use the new Windows environment for target detection

Yaron Keren yaron.keren at gmail.com
Sun Mar 30 11:58:49 PDT 2014


Hi Saleem,

I have observed a change in behaviour in my application following r204977
and r204977, exceptions stopped working.

While still haven't found the reason for this problem, I had found code in
X86MCTargetDesc.cpp which may need to be updated updated to keep the
pre-patch behaviour.  Since TheTriple.getOS() now returns Triple::Win32 for
MinGW and CygWin the original code path will not happen for these
environments.

Attached is a patch, please look at it.

Yaron




2014-03-28 0:50 GMT+02:00 Saleem Abdulrasool <compnerd at compnerd.org>:

> Author: compnerd
> Date: Thu Mar 27 17:50:18 2014
> New Revision: 204978
>
> URL: http://llvm.org/viewvc/llvm-project?rev=204978&view=rev
> Log:
> Use the new Windows environment for target detection
>
> This follows the LLVM change to canonicalise the Windows target triple
> spellings.  Rather than treating each Windows environment as a single
> entity,
> the environments are now modelled properly as an environment.  This is a
> mechanical change to convert the triple use to reflect that change.
>
> Modified:
>     cfe/trunk/include/clang/Basic/Attr.td
>     cfe/trunk/lib/AST/ItaniumCXXABI.cpp
>     cfe/trunk/lib/Basic/TargetInfo.cpp
>     cfe/trunk/lib/Basic/Targets.cpp
>     cfe/trunk/lib/CodeGen/TargetInfo.cpp
>     cfe/trunk/lib/Driver/Driver.cpp
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/lib/Driver/WindowsToolChain.cpp
>     cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>     cfe/trunk/test/CodeGenCXX/microsoft-interface.cpp
>     cfe/trunk/test/Driver/clang-translation.c
>     cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Thu Mar 27 17:50:18 2014
> @@ -234,7 +234,7 @@ def TargetARM : TargetArch<["arm", "thum
>  def TargetMSP430 : TargetArch<["msp430"]>;
>  def TargetX86 : TargetArch<["x86"]>;
>  def TargetX86Win : TargetArch<["x86", "x86_64"]> {
> -  let OSes = ["Win32", "MinGW32"];
> +  let OSes = ["Win32"];
>  }
>  def TargetMips : TargetArch<["mips", "mipsel"]>;
>
>
> Modified: cfe/trunk/lib/AST/ItaniumCXXABI.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumCXXABI.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ItaniumCXXABI.cpp (original)
> +++ cfe/trunk/lib/AST/ItaniumCXXABI.cpp Thu Mar 27 17:50:18 2014
> @@ -65,7 +65,7 @@ public:
>
>    CallingConv getDefaultMethodCallConv(bool isVariadic) const override {
>      const llvm::Triple &T = Context.getTargetInfo().getTriple();
> -    if (!isVariadic && T.getOS() == llvm::Triple::MinGW32 &&
> +    if (!isVariadic && T.isWindowsGNUEnvironment() &&
>          T.getArch() == llvm::Triple::x86)
>        return CC_X86ThisCall;
>      return CC_C;
>
> Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/Basic/TargetInfo.cpp Thu Mar 27 17:50:18 2014
> @@ -83,7 +83,7 @@ TargetInfo::TargetInfo(const llvm::Tripl
>    ComplexLongDoubleUsesFP2Ret = false;
>
>    // Set the C++ ABI based on the triple.
> -  TheCXXABI.set(Triple.getOS() == llvm::Triple::Win32
> +  TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
>                      ? TargetCXXABI::Microsoft
>                      : TargetCXXABI::GenericItanium);
>
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Thu Mar 27 17:50:18 2014
> @@ -5889,12 +5889,18 @@ static TargetInfo *AllocateTarget(const
>        return new MinixTargetInfo<X86_32TargetInfo>(Triple);
>      case llvm::Triple::Solaris:
>        return new SolarisTargetInfo<X86_32TargetInfo>(Triple);
> -    case llvm::Triple::Cygwin:
> -      return new CygwinX86_32TargetInfo(Triple);
> -    case llvm::Triple::MinGW32:
> -      return new MinGWX86_32TargetInfo(Triple);
> -    case llvm::Triple::Win32:
> -      return new VisualStudioWindowsX86_32TargetInfo(Triple);
> +    case llvm::Triple::Win32: {
> +      switch (Triple.getEnvironment()) {
> +      default:
> +        return new X86_32TargetInfo(Triple);
> +      case llvm::Triple::Cygnus:
> +        return new CygwinX86_32TargetInfo(Triple);
> +      case llvm::Triple::GNU:
> +        return new MinGWX86_32TargetInfo(Triple);
> +      case llvm::Triple::MSVC:
> +        return new VisualStudioWindowsX86_32TargetInfo(Triple);
> +      }
> +    }
>      case llvm::Triple::Haiku:
>        return new HaikuX86_32TargetInfo(Triple);
>      case llvm::Triple::RTEMS:
> @@ -5906,7 +5912,7 @@ static TargetInfo *AllocateTarget(const
>      }
>
>    case llvm::Triple::x86_64:
> -    if (Triple.isOSDarwin() || Triple.getObjectFormat() ==
> llvm::Triple::MachO)
> +    if (Triple.isOSDarwin() || Triple.isOSBinFormatMachO())
>        return new DarwinX86_64TargetInfo(Triple);
>
>      switch (os) {
> @@ -5928,10 +5934,16 @@ static TargetInfo *AllocateTarget(const
>        return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple);
>      case llvm::Triple::Solaris:
>        return new SolarisTargetInfo<X86_64TargetInfo>(Triple);
> -    case llvm::Triple::MinGW32:
> -      return new MinGWX86_64TargetInfo(Triple);
> -    case llvm::Triple::Win32:   // This is what Triple.h supports now.
> -      return new VisualStudioWindowsX86_64TargetInfo(Triple);
> +    case llvm::Triple::Win32: {
> +      switch (Triple.getEnvironment()) {
> +      default:
> +        return new X86_64TargetInfo(Triple);
> +      case llvm::Triple::GNU:
> +        return new MinGWX86_64TargetInfo(Triple);
> +      case llvm::Triple::MSVC:
> +        return new VisualStudioWindowsX86_64TargetInfo(Triple);
> +      }
> +    }
>      case llvm::Triple::NaCl:
>        return new NaClTargetInfo<X86_64TargetInfo>(Triple);
>      default:
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Mar 27 17:50:18 2014
> @@ -2732,7 +2732,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
>        return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
>
>      // FIXME: mingw-w64-gcc emits 128-bit struct as i128
> -    if (Size == 128 && getTarget().getTriple().getOS() ==
> llvm::Triple::MinGW32)
> +    if (Size == 128 && getTarget().getTriple().isWindowsGNUEnvironment())
>        return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
>                                                            Size));
>
> @@ -4768,15 +4768,22 @@ bool X86_32TargetCodeGenInfo::isStructRe
>      return true;
>
>    switch (Triple.getOS()) {
> -  case llvm::Triple::Cygwin:
> -  case llvm::Triple::MinGW32:
>    case llvm::Triple::AuroraUX:
>    case llvm::Triple::DragonFly:
>    case llvm::Triple::FreeBSD:
>    case llvm::Triple::OpenBSD:
>    case llvm::Triple::Bitrig:
> -  case llvm::Triple::Win32:
>      return true;
> +  case llvm::Triple::Win32:
> +    switch (Triple.getEnvironment()) {
> +    case llvm::Triple::UnknownEnvironment:
> +    case llvm::Triple::Cygnus:
> +    case llvm::Triple::GNU:
> +    case llvm::Triple::MSVC:
> +      return true;
> +    default:
> +      return false;
> +    }
>    default:
>      return false;
>    }
> @@ -5847,7 +5854,7 @@ const TargetCodeGenInfo &CodeGenModule::
>      bool IsDarwinVectorABI = Triple.isOSDarwin();
>      bool IsSmallStructInRegABI =
>          X86_32TargetCodeGenInfo::isStructReturnInRegABI(Triple,
> CodeGenOpts);
> -    bool IsWin32FloatStructABI = (Triple.getOS() == llvm::Triple::Win32);
> +    bool IsWin32FloatStructABI = Triple.isWindowsMSVCEnvironment();
>
>      if (Triple.getOS() == llvm::Triple::Win32) {
>        return *(TheTargetCodeGenInfo =
> @@ -5886,6 +5893,5 @@ const TargetCodeGenInfo &CodeGenModule::
>      return *(TheTargetCodeGenInfo = new SparcV9TargetCodeGenInfo(Types));
>    case llvm::Triple::xcore:
>      return *(TheTargetCodeGenInfo = new XCoreTargetCodeGenInfo(Types));
> -
>    }
>  }
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Thu Mar 27 17:50:18 2014
> @@ -1948,10 +1948,29 @@ const ToolChain &Driver::getToolChain(co
>        TC = new toolchains::Solaris(*this, Target, Args);
>        break;
>      case llvm::Triple::Win32:
> -      TC = new toolchains::Windows(*this, Target, Args);
> +      switch (Target.getEnvironment()) {
> +      default:
> +        if (Target.isOSBinFormatELF())
> +          TC = new toolchains::Generic_ELF(*this, Target, Args);
> +        else if (Target.isOSBinFormatMachO())
> +          TC = new toolchains::MachO(*this, Target, Args);
> +        else
> +          TC = new toolchains::Generic_GCC(*this, Target, Args);
> +        break;
> +      case llvm::Triple::GNU:
> +        // FIXME: We need a MinGW toolchain.  Use the default Generic_GCC
> +        // toolchain for now as the default case would below otherwise.
> +        if (Target.isOSBinFormatELF())
> +          TC = new toolchains::Generic_ELF(*this, Target, Args);
> +        else
> +          TC = new toolchains::Generic_GCC(*this, Target, Args);
> +        break;
> +      case llvm::Triple::MSVC:
> +      case llvm::Triple::UnknownEnvironment:
> +        TC = new toolchains::Windows(*this, Target, Args);
> +        break;
> +      }
>        break;
> -    case llvm::Triple::MinGW32:
> -      // FIXME: We need a MinGW toolchain. Fallthrough for now.
>      default:
>        // TCE is an OSless target
>        if (Target.getArchName() == "tce") {
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 27 17:50:18 2014
> @@ -681,11 +681,9 @@ StringRef tools::arm::getARMFloatABI(con
>        default:
>          // Assume "soft", but warn the user we are guessing.
>          FloatABI = "soft";
> -        // *-macho defaults to "soft"
> -        if (Triple.getOS() == llvm::Triple::UnknownOS &&
> -            Triple.getObjectFormat() == llvm::Triple::MachO)
> -          break;
> -        D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
> +        if (Triple.getOS() != llvm::Triple::UnknownOS ||
> +            !Triple.isOSBinFormatMachO())
> +          D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
>          break;
>        }
>      }
> @@ -2103,6 +2101,10 @@ void Clang::ConstructJob(Compilation &C,
>    const Driver &D = getToolChain().getDriver();
>    ArgStringList CmdArgs;
>
> +  bool IsWindowsGNU =
> getToolChain().getTriple().isWindowsGNUEnvironment();
> +  bool IsWindowsCygnus =
> getToolChain().getTriple().isWindowsCygwinEnvironment();
> +  bool IsWindowsMSVC =
> getToolChain().getTriple().isWindowsMSVCEnvironment();
> +
>    assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
>
>    // Invoke ourselves in -cc1 mode.
> @@ -2211,7 +2213,7 @@ void Clang::ConstructJob(Compilation &C,
>      if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
>        CmdArgs.push_back("-analyzer-checker=core");
>
> -      if (getToolChain().getTriple().getOS() != llvm::Triple::Win32)
> +      if (!IsWindowsMSVC)
>          CmdArgs.push_back("-analyzer-checker=unix");
>
>        if (getToolChain().getTriple().getVendor() == llvm::Triple::Apple)
> @@ -2961,7 +2963,7 @@ void Clang::ConstructJob(Compilation &C,
>      if (!types::isCXX(InputType))
>        Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
>                                  "-std=", /*Joined=*/true);
> -    else if (getToolChain().getTriple().getOS() == llvm::Triple::Win32)
> +    else if (IsWindowsMSVC)
>        CmdArgs.push_back("-std=c++11");
>
>      Args.AddLastArg(CmdArgs, options::OPT_trigraphs);
> @@ -3451,33 +3453,30 @@ void Clang::ConstructJob(Compilation &C,
>      CmdArgs.push_back("-fno-threadsafe-statics");
>
>    // -fuse-cxa-atexit is default.
> -  if (!Args.hasFlag(
> -           options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
> -           getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&
> -               getToolChain().getTriple().getOS() !=
> llvm::Triple::MinGW32 &&
> -               getToolChain().getArch() != llvm::Triple::hexagon &&
> -               getToolChain().getArch() != llvm::Triple::xcore) ||
> +  if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
> +                    options::OPT_fno_use_cxa_atexit,
> +                    !IsWindowsCygnus && !IsWindowsGNU &&
> +                    getToolChain().getArch() != llvm::Triple::hexagon &&
> +                    getToolChain().getArch() != llvm::Triple::xcore) ||
>        KernelOrKext)
>      CmdArgs.push_back("-fno-use-cxa-atexit");
>
>    // -fms-extensions=0 is default.
>    if (Args.hasFlag(options::OPT_fms_extensions,
> options::OPT_fno_ms_extensions,
> -                   getToolChain().getTriple().getOS() ==
> llvm::Triple::Win32))
> +                   IsWindowsMSVC))
>      CmdArgs.push_back("-fms-extensions");
>
>    // -fms-compatibility=0 is default.
>    if (Args.hasFlag(options::OPT_fms_compatibility,
>                     options::OPT_fno_ms_compatibility,
> -                   (getToolChain().getTriple().getOS() ==
> llvm::Triple::Win32 &&
> -                    Args.hasFlag(options::OPT_fms_extensions,
> -                                 options::OPT_fno_ms_extensions,
> -                                 true))))
> +                   (IsWindowsMSVC &&
> Args.hasFlag(options::OPT_fms_extensions,
> +
>  options::OPT_fno_ms_extensions,
> +                                                  true))))
>      CmdArgs.push_back("-fms-compatibility");
>
>    // -fmsc-version=1700 is default.
>    if (Args.hasFlag(options::OPT_fms_extensions,
> options::OPT_fno_ms_extensions,
> -                   getToolChain().getTriple().getOS() ==
> llvm::Triple::Win32) ||
> -      Args.hasArg(options::OPT_fmsc_version)) {
> +                   IsWindowsMSVC) ||
> Args.hasArg(options::OPT_fmsc_version)) {
>      StringRef msc_ver = Args.getLastArgValue(options::OPT_fmsc_version);
>      if (msc_ver.empty())
>        CmdArgs.push_back("-fmsc-version=1700");
> @@ -3494,8 +3493,7 @@ void Clang::ConstructJob(Compilation &C,
>    // -fno-delayed-template-parsing is default, except for Windows where
> MSVC STL
>    // needs it.
>    if (Args.hasFlag(options::OPT_fdelayed_template_parsing,
> -                   options::OPT_fno_delayed_template_parsing,
> -                   getToolChain().getTriple().getOS() ==
> llvm::Triple::Win32))
> +                   options::OPT_fno_delayed_template_parsing,
> IsWindowsMSVC))
>      CmdArgs.push_back("-fdelayed-template-parsing");
>
>    // -fgnu-keywords default varies depending on language; only pass if
>
> Modified: cfe/trunk/lib/Driver/WindowsToolChain.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/WindowsToolChain.cpp (original)
> +++ cfe/trunk/lib/Driver/WindowsToolChain.cpp Thu Mar 27 17:50:18 2014
> @@ -43,7 +43,7 @@ Tool *Windows::buildLinker() const {
>  }
>
>  Tool *Windows::buildAssembler() const {
> -  if (getTriple().getObjectFormat() == llvm::Triple::MachO)
> +  if (getTriple().isOSBinFormatMachO())
>      return new tools::darwin::Assemble(*this);
>    getDriver().Diag(clang::diag::err_no_external_assembler);
>    return NULL;
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Thu Mar 27 17:50:18 2014
> @@ -268,7 +268,6 @@ void InitHeaderSearch::AddDefaultCInclud
>
>    switch (os) {
>    case llvm::Triple::Linux:
> -  case llvm::Triple::Win32:
>      llvm_unreachable("Include management is handled in the driver.");
>
>    case llvm::Triple::Haiku:
> @@ -307,10 +306,13 @@ void InitHeaderSearch::AddDefaultCInclud
>      break;
>    case llvm::Triple::RTEMS:
>      break;
> -  case llvm::Triple::Cygwin:
> -    AddPath("/usr/include/w32api", System, false);
> -    break;
> -  case llvm::Triple::MinGW32: {
> +  case llvm::Triple::Win32:
> +    switch (triple.getEnvironment()) {
> +    default: llvm_unreachable("Include management is handled in the
> driver.");
> +    case llvm::Triple::Cygnus:
> +      AddPath("/usr/include/w32api", System, false);
> +      break;
> +    case llvm::Triple::GNU:
>        // mingw-w64 crt include paths
>        // <sysroot>/i686-w64-mingw32/include
>        SmallString<128> P = StringRef(HSOpts.ResourceDir);
> @@ -331,9 +333,9 @@ void InitHeaderSearch::AddDefaultCInclud
>  #if defined(LLVM_ON_WIN32)
>        AddPath("c:/mingw/include", System, false);
>  #endif
> +      break;
>      }
>      break;
> -
>    default:
>      break;
>    }
> @@ -382,37 +384,40 @@ AddDefaultCPlusPlusIncludePaths(const ll
>
>    switch (os) {
>    case llvm::Triple::Linux:
> -  case llvm::Triple::Win32:
>      llvm_unreachable("Include management is handled in the driver.");
>
> -  case llvm::Triple::Cygwin:
> -    // Cygwin-1.7
> -    AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.7.3");
> -    AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.5.3");
> -    AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.3.4");
> -    // g++-4 / Cygwin-1.5
> -    AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.3.2");
> -    break;
> -  case llvm::Triple::MinGW32:
> -    // mingw-w64 C++ include paths (i686-w64-mingw32 and
> x86_64-w64-mingw32)
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.1");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.2");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.3");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.0");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.1");
> -    AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.2");
> -    // mingw.org C++ include paths
> +  case llvm::Triple::Win32:
> +    switch (triple.getEnvironment()) {
> +    default: llvm_unreachable("Include management is handled in the
> driver.");
> +    case llvm::Triple::Cygnus:
> +      // Cygwin-1.7
> +      AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.7.3");
> +      AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.5.3");
> +      AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.3.4");
> +      // g++-4 / Cygwin-1.5
> +      AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
> "4.3.2");
> +      break;
> +    case llvm::Triple::GNU:
> +      // mingw-w64 C++ include paths (i686-w64-mingw32 and
> x86_64-w64-mingw32)
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.1");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.2");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.3");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.0");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.1");
> +      AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.2");
> +      // mingw.org C++ include paths
>  #if defined(LLVM_ON_WIN32)
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.7.0");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.7.1");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.7.2");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.7.3");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.8.0");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.8.1");
> -    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.8.2");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.7.0");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.7.1");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.7.2");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.7.3");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.8.0");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.8.1");
> +      AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32",
> "4.8.2");
>  #endif
> -    break;
> +      break;
> +    }
>    case llvm::Triple::DragonFly:
>      if (llvm::sys::fs::exists("/usr/lib/gcc47"))
>        AddPath("/usr/include/c++/4.7", CXXSystem, false);
> @@ -457,8 +462,13 @@ void InitHeaderSearch::AddDefaultInclude
>      break; // Everything else continues to use this routine's logic.
>
>    case llvm::Triple::Linux:
> -  case llvm::Triple::Win32:
>      return;
> +
> +  case llvm::Triple::Win32:
> +    if (triple.getEnvironment() == llvm::Triple::MSVC ||
> +        triple.getEnvironment() == llvm::Triple::Itanium)
> +      return;
> +    break;
>    }
>
>    if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes &&
>
> Modified: cfe/trunk/test/CodeGenCXX/microsoft-interface.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-interface.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/microsoft-interface.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/microsoft-interface.cpp Thu Mar 27 17:50:18
> 2014
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft
> -triple=i386-pc-mingw32 -emit-llvm %s -o - | FileCheck %s
> +// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft
> -triple=i386-pc-windows-gnu -emit-llvm %s -o - | FileCheck %s
>
>  __interface I {
>    int test() {
>
> Modified: cfe/trunk/test/Driver/clang-translation.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-translation.c?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Driver/clang-translation.c (original)
> +++ cfe/trunk/test/Driver/clang-translation.c Thu Mar 27 17:50:18 2014
> @@ -203,7 +203,7 @@
>  // AMD64-MINGW: clang
>  // AMD64-MINGW: "-cc1"
>  // AMD64-MINGW: "-triple"
> -// AMD64-MINGW: "amd64--mingw32"
> +// AMD64-MINGW: "amd64--windows-gnu"
>  // AMD64-MINGW: "-munwind-tables"
>
>  // RUN: %clang -target i686-linux-android -### -S %s 2>&1 \
>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=204978&r1=204977&r2=204978&view=diff
>
> ==============================================================================
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Thu Mar 27
> 17:50:18 2014
> @@ -105,8 +105,9 @@ TEST(NameableDeclaration, REMatchesVario
>
>  TEST(DeclarationMatcher, MatchClass) {
>    DeclarationMatcher ClassMatcher(recordDecl());
> -  if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getOS() !=
> -      llvm::Triple::Win32)
> +  llvm::Triple Triple(llvm::sys::getDefaultTargetTriple());
> +  if (Triple.getOS() != llvm::Triple::Win32 ||
> +      Triple.getEnvironment() != llvm::Triple::MSVC)
>      EXPECT_FALSE(matches("", ClassMatcher));
>    else
>      // Matches class type_info.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140330/1733f8ae/attachment.html>
-------------- next part --------------
Index: lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
===================================================================
--- lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp	(revision 204978)
+++ lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp	(working copy)
@@ -205,8 +205,7 @@
 
   if (TheTriple.isOSDarwin())
     return isEH ? DWARFFlavour::X86_32_DarwinEH : DWARFFlavour::X86_32_Generic;
-  if (TheTriple.getOS() == Triple::MinGW32 ||
-      TheTriple.getOS() == Triple::Cygwin)
+  if (TheTriple.isOSCygMing())
     // Unsupported by now, just quick fallback
     return DWARFFlavour::X86_32_Generic;
   return DWARFFlavour::X86_32_Generic;
@@ -279,10 +278,9 @@
   } else if (TheTriple.isOSBinFormatELF()) {
     // Force the use of an ELF container.
     MAI = new X86ELFMCAsmInfo(TheTriple);
-  } else if (TheTriple.getOS() == Triple::Win32) {
+  } else if (TheTriple.isWindowsMSVCEnvironment()) {
     MAI = new X86MCAsmInfoMicrosoft(TheTriple);
-  } else if (TheTriple.getOS() == Triple::MinGW32 ||
-             TheTriple.getOS() == Triple::Cygwin) {
+  } else if (TheTriple.isOSCygMing()) {
     MAI = new X86MCAsmInfoGNUCOFF(TheTriple);
   } else {
     // The default is ELF.


More information about the cfe-commits mailing list