Teach Clang to cope with GCC installations that have unusual patch
"versions". Currently, these are just dropped on the floor, A concrete
version number will always win out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141159 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 33b1916..0e9dcd1 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1508,9 +1508,11 @@
return BadVersion;
if (Second.first.getAsInteger(10, GoodVersion.Minor))
return BadVersion;
- if (!Second.first.empty())
- if (Second.first.getAsInteger(10, GoodVersion.Patch))
- return BadVersion;
+ // We accept a number, or a string for the patch version, in case there
+ // is a strang suffix, or other mangling: '4.1.x', '4.1.2-rc3'. When it
+ // isn't a number, we just use '0' as the number but accept it.
+ if (Second.first.getAsInteger(10, GoodVersion.Patch))
+ GoodVersion.Patch = 0;
return GoodVersion;
}