Improve Windows toolchain support for non-standard environments.
Typically clang finds Visual Studio by the user explicitly setting
up a Visual Studio environment via vcvarsall. But we still try to
behave intelligently and fallback to different methods of finding
Visual Studio when this is not done. This patch improves various
fallback codepaths to make Visual Studio locating more robust.
Specifically, this patch:
- Adds support for searching environment variables for VS 12.0
- Correctly locates include folders for Windows SDK 8.x (this was previously broken, and would cause clang to error)
- Prefers locating link.exe in the same location as cl.exe. This is helpful in case another link.exe is in the path earlier than Visual Studio (e.g. GnuWin32)
- Minor cleanup in the registry reading code to make it more robust in the presence of long pathnames.