r288061 - [Driver] Fix recognizing newer OpenSUSE versions
Michal Gorny via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 28 13:11:18 PST 2016
Author: mgorny
Date: Mon Nov 28 15:11:18 2016
New Revision: 288061
URL: http://llvm.org/viewvc/llvm-project?rev=288061&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Driver/Distro.cpp
Modified: cfe/trunk/lib/Driver/Distro.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Distro.cpp?rev=288061&r1=288060&r2=288061&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Distro.cpp (original)
+++ cfe/trunk/lib/Driver/Distro.cpp Mon Nov 28 15:11:18 2016
@@ -108,11 +108,14 @@ static Distro::DistroType DetectDistro(v
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;
}
More information about the cfe-commits
mailing list