summaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains/Linux.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2019-05-21 21:21:35 +0000
committerNick Desaulniers <ndesaulniers@google.com>2019-05-21 21:21:35 +0000
commite9f666dff4764e65704d0145c35d57a7467d8e51 (patch)
tree3e47f64abe3fd855f87776ba0f5af360c195e872 /lib/Driver/ToolChains/Linux.cpp
parent667b24c87f4c053082ce43d7a44aff881167231a (diff)
downloadclang-e9f666dff4764e65704d0145c35d57a7467d8e51.tar.gz
[Driver] Verify GCCInstallation is valid
Summary: Values returned by GCCInstallation.getParentLibPath() and GCCInstallation.getTriple() are not valid unless GCCInstallation.isValid() returns true. This has previously been ignored, and the former two values were used without checking whether GCCInstallation is valid. This led to the bad path "/../bin" being added to the list of program paths. author: danielmentz "Daniel Mentz <danielmentz@google.com>" Reviewers: #clang, tstellar, srhines Reviewed By: srhines Subscribers: danielmentz, ormris, nickdesaulniers, srhines, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57930 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Linux.cpp')
-rw-r--r--lib/Driver/ToolChains/Linux.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index e9169e91fd..4890ef4575 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -234,9 +234,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// 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());