summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Distro.cpp
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2016-11-28 21:11:18 +0000
committerMichal Gorny <mgorny@gentoo.org>2016-11-28 21:11:18 +0000
commit047e099a2eedf9b3a795d5fd58eb6a9e2001d48d (patch)
treeab2bbcb6064e8f27355ca2361f4121616d9975ff /clang/lib/Driver/Distro.cpp
parent67e199eb32633f9f8dfd5e982063156c98d2358b (diff)
downloadbcm5719-llvm-047e099a2eedf9b3a795d5fd58eb6a9e2001d48d.tar.gz
bcm5719-llvm-047e099a2eedf9b3a795d5fd58eb6a9e2001d48d.zip
[Driver] Fix recognizing newer OpenSUSE versions
Fix recognizing newer OpenSUSE versions that combine the two version components into 'VERSION = x.y'. The check was written against an older version that kept those two split as VERSION and PATCHLEVEL. Differential Revision: https://reviews.llvm.org/D26850 llvm-svn: 288061
Diffstat (limited to 'clang/lib/Driver/Distro.cpp')
-rw-r--r--clang/lib/Driver/Distro.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
index 7a12643405d..d305b179449 100644
--- a/clang/lib/Driver/Distro.cpp
+++ b/clang/lib/Driver/Distro.cpp
@@ -108,11 +108,14 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
if (!Line.trim().startswith("VERSION"))
continue;
std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+ // Old versions have split VERSION and PATCHLEVEL
+ // Newer versions use VERSION = x.y
+ std::pair<StringRef, StringRef> SplitVer = SplitLine.second.trim().split('.');
int Version;
+
// OpenSUSE/SLES 10 and older are not supported and not compatible
// with our rules, so just treat them as Distro::UnknownDistro.
- if (!SplitLine.second.trim().getAsInteger(10, Version) &&
- Version > 10)
+ if (!SplitVer.first.getAsInteger(10, Version) && Version > 10)
return Distro::OpenSUSE;
return Distro::UnknownDistro;
}
OpenPOWER on IntegriCloud