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