[clang] [MinGW] Fix gcc version detection/picking
authorMartin Storsjö <martin@martin.st>
Thu, 20 May 2021 20:45:21 +0000 (23:45 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 28 May 2021 08:44:20 +0000 (11:44 +0300)
commitf59cd8a4a606643e7248cecc239e0d229feb3320
tree8c6e9e58e0e6caab220a82543691a077ec50a366
parentf2264ebb087272d49e2216476a62f3208ba5a1ea
[clang] [MinGW] Fix gcc version detection/picking

Actually compare each version to the version of the last chosen one.

There's no guarantee that the added test case does showcase the
previous issue (it depends on the order that directory entries
are returned when iterating), but with the issue fixed it should behave
deterministically in any case.

Also improve the match patterns in the mingw-sysroot.cpp test a bit.

Differential Revision: https://reviews.llvm.org/D102873
clang/lib/Driver/ToolChains/MinGW.cpp
clang/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/10.2-posix/include-fixed/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/10.2-posix/include/c++/backward/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/10.2-posix/include/c++/x86_64-w64-mingw32/.keep [new file with mode: 0644]
clang/test/Driver/mingw-sysroot.cpp
clang/test/Driver/mingw.cpp