]> granicus.if.org Git - clang/commitdiff
Revert r188531: "Windows ToolChain: add VS bin dir to PogramPaths"
authorHans Wennborg <hans@hanshq.net>
Fri, 30 Aug 2013 09:42:06 +0000 (09:42 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 30 Aug 2013 09:42:06 +0000 (09:42 +0000)
This never really worked. Even if we find and execute link.exe in the VS bin dir
this way, link.exe wouldn't find the DLLs it needs, libraries, etc.

It also causes trouble when the user has multiple versions of VS installed,
one of them is in the path, but this code finds the other one (PR17041).

Revert until we can fix this properly.

> Windows ToolChain: add VS bin dir to PogramPaths
>
> We have a lot of fancy logic to find Visual Studio, which is currently used
> to set the system header include paths.
>
> Use the same code to set the ProgramPaths, which is used for finding programs
> such as link.exe. Previously, Clang would just search PATH for link.exe,
> but now it should find it if it's able to find Visual Studio.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/WindowsToolChain.cpp

index 65887a7f418be8aaa8b5431fb0b5f3531b4c8fc9..3cbb5c83df9120d27ac3f2bb99535fa690b502a4 100644 (file)
@@ -33,6 +33,42 @@ using namespace clang::driver::toolchains;
 using namespace clang;
 using namespace llvm::opt;
 
+Windows::Windows(const Driver &D, const llvm::Triple& Triple,
+                 const ArgList &Args)
+  : ToolChain(D, Triple, Args) {
+}
+
+Tool *Windows::buildLinker() const {
+  return new tools::visualstudio::Link(*this);
+}
+
+Tool *Windows::buildAssembler() const {
+  if (getTriple().getEnvironment() == llvm::Triple::MachO)
+    return new tools::darwin::Assemble(*this);
+  getDriver().Diag(clang::diag::err_no_external_windows_assembler);
+  return NULL;
+}
+
+bool Windows::IsIntegratedAssemblerDefault() const {
+  return true;
+}
+
+bool Windows::IsUnwindTablesDefault() const {
+  return getArch() == llvm::Triple::x86_64;
+}
+
+bool Windows::isPICDefault() const {
+  return getArch() == llvm::Triple::x86_64;
+}
+
+bool Windows::isPIEDefault() const {
+  return false;
+}
+
+bool Windows::isPICDefaultForced() const {
+  return getArch() == llvm::Triple::x86_64;
+}
+
 // FIXME: This probably should goto to some platform utils place.
 #ifdef _MSC_VER
 
@@ -164,7 +200,7 @@ static bool getWindowsSDKDir(std::string &path) {
   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");
@@ -241,47 +277,6 @@ static bool getVisualStudioDir(std::string &path) {
 
 #endif // _MSC_VER
 
-Windows::Windows(const Driver &D, const llvm::Triple& Triple,
-                 const ArgList &Args)
-  : ToolChain(D, Triple, Args) {
-#ifdef _MSC_VER
-  std::string VSDir;
-  if (getVisualStudioDir(VSDir))
-    getProgramPaths().push_back(VSDir + "\\VC\\bin");
-#endif
-}
-
-Tool *Windows::buildLinker() const {
-  return new tools::visualstudio::Link(*this);
-}
-
-Tool *Windows::buildAssembler() const {
-  if (getTriple().getEnvironment() == llvm::Triple::MachO)
-    return new tools::darwin::Assemble(*this);
-  getDriver().Diag(clang::diag::err_no_external_windows_assembler);
-  return NULL;
-}
-
-bool Windows::IsIntegratedAssemblerDefault() const {
-  return true;
-}
-
-bool Windows::IsUnwindTablesDefault() const {
-  return getArch() == llvm::Triple::x86_64;
-}
-
-bool Windows::isPICDefault() const {
-  return getArch() == llvm::Triple::x86_64;
-}
-
-bool Windows::isPIEDefault() const {
-  return false;
-}
-
-bool Windows::isPICDefaultForced() const {
-  return getArch() == llvm::Triple::x86_64;
-}
-
 void Windows::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
                                         ArgStringList &CC1Args) const {
   if (DriverArgs.hasArg(options::OPT_nostdinc))