<div>I submitted something like this to cfe-commits a few weeks ago, but I guess in the release crunch it got lost.  Here's another crack at it here, as I stopped watching the commits traffic, as it got too heavy.</div>

<div> </div>
<div>It's another pass at refining Targets.cpp for Windows targets, revised for the current repository.  From my original email:</div>
<div> </div>
<div>***</div>
<p>Unfortunately, it requires some LLVM enhancements, placed in the<br>separate llvm_triple_enhancement.patch file:</p>
<p>I extended the Triple class, supporting more explicitly the optional<br>environment field, adding an EnvironmentType enum for that with an<br>item for Visual Studio (-vc), and adding a Win64 OSType.  There are<br>probably more environments that can be added to the EnvironmentType<br>
enum.</p>
<p>Changed the default triples from cmake to be i686-pc-win32-vc and if<br>64-bit is enabled, x86_64-pc-win64-vc.</p>
<p>The Targets.cpp changes, placed in clang_targets_enhancement.patch:</p>
<div>Added separate TargetInfo's for Visual Studio, MinGW, and Cygwin, as<br>illustrated by the following hierarchy:</div>
<div><br>TargetInfo<br>  X86TargetInfo<br>      X86_32TargetInfo<br>          DarwinI386TargetInfo<br>          OpenBSDI386TargetInfo</div>
<div>          CygwinWindowsX86_32TargetInfo  (i686-pc-cygwin) (new)<br>          WindowsX86_32TargetInfo (i686-pc-win32)<br>              VisualStudioWindowsX86_32TargetInfo  (i686-pc-win32-vc) (new)<br>              MinGWX86_32TargetInfo  (i686-pc-mingw32) (new)</div>

<div>       X86_64TargetInfo<br>          DarwinX86_64TargetInfo<br>          OpenBSDX86_64TargetInfo<br>          WindowsX86_64TargetInfo  (x86_64-pc-win64) (new)</div>
<div>              VisualStudioWindowsX86_64TargetInfo  (x86_64-pc-win64-vc) (new)<br>              MinGWX86_64TargetInfo  (x86_64-pc-mingw64) (new)</div>
<p>Messing with the triple was of some concern to me, so I also tried an<br>alternate approach without adding -vc to the triple, making the<br>default -win32 map to Visual Studio, and having MinGW and Cygwin be<br>separate as above, but then I figured you might want -winXX with no<br>
environment field to be the native Clang target for Windows, mapping<br>to the generic Windows TargetInfo, assuming at some point Clang has<br>it's own runtime and headers.  But let me know if this would be the<br>more desired approach.</p>

<p>Note that though I've tested the Targets;cpp part in the debugger,<br>I've not yet been able to build, and therefore, run the LLVM tests.  I<br>don't expect the Triple class changes to change any existing behavior,<br>
but I have a slight worry that the change of the default triple from<br>cmake might impact something, but being on the apparently less-used<br>cmake path, perhaps it's less of a concern.  I built and ran the Clang<br>
tests on Linux successfully.</p>
<div>-John</div>
<div><br clear="all"> </div>
<div></div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>