ProjectExplorer: Fix clang ABI detection

Change-Id: I809f8b747ffb64ed128fd0f957d13d670604d050
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2017-04-06 16:25:16 +03:00
committed by Orgad Shaneh
parent 5828205418
commit d186d85bcf
3 changed files with 33 additions and 14 deletions

View File

@@ -789,6 +789,28 @@ QList<Abi::OSFlavor> Abi::flavorsForOs(const Abi::OS &o)
return result; return result;
} }
Abi::OSFlavor Abi::flavorForMsvcVersion(int version)
{
if (version >= 1910)
return WindowsMsvc2017Flavor;
switch (version) {
case 1900:
return WindowsMsvc2015Flavor;
case 1800:
return WindowsMsvc2013Flavor;
case 1700:
return WindowsMsvc2012Flavor;
case 1600:
return WindowsMsvc2010Flavor;
case 1500:
return WindowsMsvc2008Flavor;
case 1400:
return WindowsMsvc2005Flavor;
default:
return WindowsMSysFlavor;
}
}
Abi Abi::hostAbi() Abi Abi::hostAbi()
{ {
Architecture arch = QTC_CPU; // define set by qmake Architecture arch = QTC_CPU; // define set by qmake
@@ -798,20 +820,8 @@ Abi Abi::hostAbi()
#if defined (Q_OS_WIN) #if defined (Q_OS_WIN)
os = WindowsOS; os = WindowsOS;
#if _MSC_VER >= 1910 #ifdef _MSC_VER
subos = WindowsMsvc2017Flavor; subos = flavorForMsvcVersion(_MSC_VER);
#elif _MSC_VER == 1900
subos = WindowsMsvc2015Flavor;
#elif _MSC_VER == 1800
subos = WindowsMsvc2013Flavor;
#elif _MSC_VER == 1700
subos = WindowsMsvc2012Flavor;
#elif _MSC_VER == 1600
subos = WindowsMsvc2010Flavor;
#elif _MSC_VER == 1500
subos = WindowsMsvc2008Flavor;
#elif _MSC_VER == 1400
subos = WindowsMsvc2005Flavor;
#elif defined (Q_CC_MINGW) #elif defined (Q_CC_MINGW)
subos = WindowsMSysFlavor; subos = WindowsMSysFlavor;
#endif #endif

View File

@@ -139,6 +139,7 @@ public:
static QString toString(int w); static QString toString(int w);
static QList<OSFlavor> flavorsForOs(const OS &o); static QList<OSFlavor> flavorsForOs(const OS &o);
static OSFlavor flavorForMsvcVersion(int version);
static Abi hostAbi(); static Abi hostAbi();
static QList<Abi> abisOfBinary(const Utils::FileName &path); static QList<Abi> abisOfBinary(const Utils::FileName &path);

View File

@@ -269,11 +269,19 @@ static QList<Abi> guessGccAbi(const QString &m, const QByteArray &macros)
Abi::OSFlavor flavor = guessed.osFlavor(); Abi::OSFlavor flavor = guessed.osFlavor();
Abi::BinaryFormat format = guessed.binaryFormat(); Abi::BinaryFormat format = guessed.binaryFormat();
int width = guessed.wordWidth(); int width = guessed.wordWidth();
const QByteArray mscVer = "#define _MSC_VER ";
if (macros.contains("#define __SIZEOF_SIZE_T__ 8")) if (macros.contains("#define __SIZEOF_SIZE_T__ 8"))
width = 64; width = 64;
else if (macros.contains("#define __SIZEOF_SIZE_T__ 4")) else if (macros.contains("#define __SIZEOF_SIZE_T__ 4"))
width = 32; width = 32;
int mscVerIndex = macros.indexOf(mscVer);
if (mscVerIndex != -1) {
mscVerIndex += mscVer.length();
const int eol = macros.indexOf('\n', mscVerIndex);
const int msvcVersion = macros.mid(mscVerIndex, eol - mscVerIndex).toInt();
flavor = Abi::flavorForMsvcVersion(msvcVersion);
}
if (os == Abi::DarwinOS) { if (os == Abi::DarwinOS) {
// Apple does PPC and x86! // Apple does PPC and x86!