[PATCH] D57930: [Driver] Verify GCCInstallation is valid

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 14:18:54 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC361314: [Driver] Verify GCCInstallation is valid (authored by nickdesaulniers, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D57930?vs=200580&id=200586#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57930/new/

https://reviews.llvm.org/D57930

Files:
  lib/Driver/ToolChains/Linux.cpp
  test/Driver/B-opt.c


Index: test/Driver/B-opt.c
===================================================================
--- test/Driver/B-opt.c
+++ test/Driver/B-opt.c
@@ -20,3 +20,8 @@
 // RUN:     -B %S/Inputs/B_opt_tree/dir2 2>&1 -fuse-ld=ld \
 // RUN:   | FileCheck --check-prefix=CHECK-B-OPT-MULT %s
 // CHECK-B-OPT-MULT: "{{.*}}/Inputs/B_opt_tree/dir3{{/|\\\\}}prefix-ld"
+//
+// RUN: %clang -B %S/Inputs/does_not_exist -print-search-dirs \
+// RUN:     -target aarch64-linux-gnu \
+// RUN:   | FileCheck --check-prefix=CHECK-B-OPT-INVALID %s
+// CHECK-B-OPT-INVALID-NOT: /..//bin
Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -234,9 +234,11 @@
   // used to target i386.
   // FIXME: This seems unlikely to be Linux-specific.
   ToolChain::path_list &PPaths = getProgramPaths();
-  PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
-                         GCCInstallation.getTriple().str() + "/bin")
-                       .str());
+  if (GCCInstallation.isValid()) {
+    PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
+                           GCCInstallation.getTriple().str() + "/bin")
+                         .str());
+  }
 
   Distro Distro(D.getVFS());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57930.200586.patch
Type: text/x-patch
Size: 1328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190521/84ad1706/attachment.bin>


More information about the cfe-commits mailing list