aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2022-10-21 11:36:37 +0200
committerTom Stellard <tstellar@redhat.com>2022-10-27 22:01:32 -0700
commit3010b7e000006f680b6bf3141be988291fa1da41 (patch)
tree238d31b93218026a5d91dadf5defc4a8a9286ce0 /clang/lib
parentdb68723804fd30d5e7da1fb2ad2aab409ef58d29 (diff)
downloadllvm-3010b7e000006f680b6bf3141be988291fa1da41.zip
llvm-3010b7e000006f680b6bf3141be988291fa1da41.tar.gz
llvm-3010b7e000006f680b6bf3141be988291fa1da41.tar.bz2
[clang][driver] Remove dynamic gcc-toolset/devtoolset logic
This breaks when the newest available devtoolset directory is not a complete toolset: https://github.com/llvm/llvm-project/issues/57843 Remove this again in favor or just adding the two new directories for devtoolset/gcc-toolset 12. This reverts commit 35aaf548237a4f213ba9d95de53b33c5ce1eadce. This reverts commit 9f97720268911abae2ad9d90e270358db234a1c1. Fixes https://github.com/llvm/llvm-project/issues/57843 Differential Revision: https://reviews.llvm.org/D136435
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains/Gnu.cpp40
1 files changed, 15 insertions, 25 deletions
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index f203cae..665cdc3 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2139,31 +2139,21 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
// and gcc-toolsets.
if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux &&
D.getVFS().exists("/opt/rh")) {
- // Find the directory in /opt/rh/ starting with gcc-toolset-* or
- // devtoolset-* with the highest version number and add that
- // one to our prefixes.
- std::string ChosenToolsetDir;
- unsigned ChosenToolsetVersion = 0;
- std::error_code EC;
- for (llvm::vfs::directory_iterator LI = D.getVFS().dir_begin("/opt/rh", EC),
- LE;
- !EC && LI != LE; LI = LI.increment(EC)) {
- StringRef ToolsetDir = llvm::sys::path::filename(LI->path());
- unsigned ToolsetVersion;
- if ((!ToolsetDir.startswith("gcc-toolset-") &&
- !ToolsetDir.startswith("devtoolset-")) ||
- ToolsetDir.substr(ToolsetDir.rfind('-') + 1)
- .getAsInteger(10, ToolsetVersion))
- continue;
-
- if (ToolsetVersion > ChosenToolsetVersion) {
- ChosenToolsetVersion = ToolsetVersion;
- ChosenToolsetDir = "/opt/rh/" + ToolsetDir.str();
- }
- }
-
- if (ChosenToolsetVersion > 0)
- Prefixes.push_back(ChosenToolsetDir + "/root/usr");
+ // TODO: We may want to remove this, since the functionality
+ // can be achieved using config files.
+ Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
+ Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
+ Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-12/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-4/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-3/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-2/root/usr");
}
// Fall back to /usr which is used by most non-Solaris systems.