[cfe-commits] r104015 - /cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Douglas Gregor
dgregor at apple.com
Mon May 17 22:47:04 PDT 2010
Author: dgregor
Date: Tue May 18 00:47:04 2010
New Revision: 104015
URL: http://llvm.org/viewvc/llvm-project?rev=104015&view=rev
Log:
"The attached patch allows clang to find the headers
for Visual Studio 2010. It also adds a registry search
for the Express edition,", from Steven Watanabe!
Modified:
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=104015&r1=104014&r2=104015&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue May 18 00:47:04 2010
@@ -324,10 +324,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");
@@ -336,25 +340,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)
@@ -425,6 +447,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(
More information about the cfe-commits
mailing list