// Include the necessary headers to interface with the Windows registry and
// environment.
-#ifdef _MSC_VER
+// TODO: Investigate enabling this with __MINGW32__.
+#if defined(_MSC_VER)
+#define USE_WIN32
+#endif
+
+#ifdef USE_WIN32
#define WIN32_LEAN_AND_MEAN
#define NOGDI
#define NOMINMAX
return getArch() == llvm::Triple::x86_64;
}
-// FIXME: This probably should goto to some platform utils place.
-#ifdef _MSC_VER
-
/// \brief Read registry string.
/// This also supports a means to look for high-versioned keys by use
/// of a $VERSION placeholder in the key path.
/// characters are compared.
static bool getSystemRegistryString(const char *keyPath, const char *valueName,
char *value, size_t maxLength) {
+#ifndef USE_WIN32
+ return false;
+#else
HKEY hRootKey = NULL;
HKEY hKey = NULL;
const char* subKey = NULL;
}
}
return returnValue;
+#endif // USE_WIN32
}
/// \brief Get Windows SDK installation directory.
return false;
}
- // Get Visual Studio installation directory.
+// Get Visual Studio installation directory.
static bool getVisualStudioDir(std::string &path) {
// First check the environment variables that vsvars32.bat sets.
const char* vcinstalldir = getenv("VCINSTALLDIR");
const char *vs100comntools = getenv("VS100COMNTOOLS");
const char *vs90comntools = getenv("VS90COMNTOOLS");
const char *vs80comntools = getenv("VS80COMNTOOLS");
- const char *vscomntools = NULL;
+
+ const char *vscomntools = nullptr;
// Try to find the version that we were compiled with
if(false) {}
return false;
}
-#endif // _MSC_VER
-
void Windows::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
if (DriverArgs.hasArg(options::OPT_nostdinc))
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
return;
-#ifdef _MSC_VER
+// TODO: This code path is portable. Conditionalize on LLVM_ON_WIN32 instead?
+#ifndef USE_WIN32
+ return;
+#endif
+
// Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat.
if (const char *cl_include_dir = getenv("INCLUDE")) {
SmallVector<StringRef, 8> Dirs;
}
// As a fallback, select default install paths.
+ // FIXME: Don't guess drives and paths like this on Windows.
const StringRef Paths[] = {
"C:/Program Files/Microsoft Visual Studio 10.0/VC/include",
"C:/Program Files/Microsoft Visual Studio 9.0/VC/include",
"C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
};
addSystemIncludes(DriverArgs, CC1Args, Paths);
-#endif // _MSC_VER
}
void Windows::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,