[cfe-commits] Windows driver cleanup (or however you want to call it)

Nikola Smiljanic popizdeh at gmail.com
Sat Jul 14 05:15:59 PDT 2012

What we have right now in the driver sucks for various reasons. Code for
handling multiple versions of VS is very complex and possibly incorrect.
How do you select the right VS (latest version?). Also how do you get the
include paths, these depend on the target. How do you find the right
link.exe, and so on.

Since Clang can't figure all this out on its own the user should be
required to follow the windows convention and run vcvars.bat or invoke
clang from VS Command prompt (it's not a real convention but I don't know
of any other way to detect active compiler on windows, one can only make
assumptions since windows doesn't have a notion of system compiler like
linux does). It's far from perfect but everything should just work from
this point on:

Environment variables have almost everything we need
INCLUDES variable is used for system includes (it also has the path to SDK)
SDK variable (don't think we need this, maybe if there is a newer  SDK
installed, but I don't think vcvars knows about the new version?)
Link.exe is in the path, and uses LIB variable to find libraries so
everything should just work
Any user supplied target triple should be ignored. This is what I find a
bit problematic, users are expected to know what is going on. The
active environment is what determines which triple to use. Michel mentioned
implementing *which *command but we actually only need the path to cl.exe
(no need to iterate over all extensions in PATHEXT). cl.exe from VC/BIN
directory targets x86 while the ones from amd64 and x86_amd64 both target

My assumption is that Win32 in the triple means "standalone Clang that uses
headers and tools provided by VS to target the Windows platform". Hope that
mingw never plays a role in here and always uses its own triple?

What do you think, have I missed anything? Here's a patch that implements
most of this stuff so you get a better idea of what I'm talking about.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120714/d6e434f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: windowsdriver.patch
Type: application/octet-stream
Size: 11200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120714/d6e434f3/attachment.obj>

More information about the cfe-commits mailing list