[cfe-commits] [Patch] Default header paths for VS 2010
Douglas Gregor
dgregor at apple.com
Mon May 17 22:48:53 PDT 2010
I've committed this as r104015. Thanks, Steven!
- Doug
On May 15, 2010, at 11:48 AM, Steven Watanabe wrote:
> AMDG
>
> The attached patch allows clang to find the headers
> for Visual Studio 2010. It also adds a registry search
> for the Express edition.
>
> In Christ,
> Steven Watanabe
>
> Index: tools/clang/lib/Frontend/InitHeaderSearch.cpp
> ===================================================================
> --- tools/clang/lib/Frontend/InitHeaderSearch.cpp (revision 103874)
> +++ tools/clang/lib/Frontend/InitHeaderSearch.cpp (working copy)
> @@ -323,10 +323,14 @@
> // Get Visual Studio installation directory.
> static bool getVisualStudioDir(std::string &path) {
> char vsIDEInstallDir[256];
> + char vsExpressIDEInstallDir[256];
> // Try the Windows registry first.
> bool hasVCDir = getSystemRegistryString(
> "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION",
> "InstallDir", vsIDEInstallDir, sizeof(vsIDEInstallDir) - 1);
> + bool hasVCExpressDir = getSystemRegistryString(
> + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\$VERSION",
> + "InstallDir", vsExpressIDEInstallDir, sizeof(vsExpressIDEInstallDir) - 1);
> // If we have both vc80 and vc90, pick version we were compiled with.
> if (hasVCDir && vsIDEInstallDir[0]) {
> char *p = (char*)strstr(vsIDEInstallDir, "\\Common7\\IDE");
> @@ -335,25 +339,43 @@
> path = vsIDEInstallDir;
> return(true);
> }
> + else if (hasVCExpressDir && vsExpressIDEInstallDir[0]) {
> + char *p = (char*)strstr(vsExpressIDEInstallDir, "\\Common7\\IDE");
> + if (p)
> + *p = '\0';
> + path = vsExpressIDEInstallDir;
> + return(true);
> + }
> else {
> // Try the environment.
> + const char* vs100comntools = getenv("VS100COMNTOOLS");
> const char* vs90comntools = getenv("VS90COMNTOOLS");
> const char* vs80comntools = getenv("VS80COMNTOOLS");
> const char* vscomntools = NULL;
> - // If we have both vc80 and vc90, pick version we were compiled with.
> - if (vs90comntools && vs80comntools) {
> - #if (_MSC_VER >= 1500) // VC90
> - vscomntools = vs90comntools;
> - #elif (_MSC_VER == 1400) // VC80
> - vscomntools = vs80comntools;
> - #else
> - vscomntools = vs90comntools;
> - #endif
> +
> + // Try to find the version that we were compiled with
> + if(false) {}
> + #if (_MSC_VER >= 1600) // VC100
> + else if(vs100comntools) {
> + vscomntools = vs100comntools;
> }
> + #elif (_MSC_VER == 1500) // VC80
> + else if(vs90comntools) {
> + vscomntools = vs90comntools;
> + }
> + #elif (_MSC_VER == 1400) // VC80
> + else if(vs80comntools) {
> + vscomntools = vs80comntools;
> + }
> + #endif
> + // Otherwise find any version we can
> + else if (vs100comntools)
> + vscomntools = vs100comntools;
> else if (vs90comntools)
> vscomntools = vs90comntools;
> else if (vs80comntools)
> vscomntools = vs80comntools;
> +
> if (vscomntools && *vscomntools) {
> char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools"));
> if (p)
> @@ -410,6 +432,8 @@
> }
> else {
> // Default install paths.
> + AddPath("C:/Program Files/Microsoft Visual Studio 10.0/VC/include",
> + System, false, false, false);
> AddPath("C:/Program Files/Microsoft Visual Studio 9.0/VC/include",
> System, false, false, false);
> AddPath(
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list