Commit d186d85b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ProjectExplorer: Fix clang ABI detection

Change-Id: I809f8b747ffb64ed128fd0f957d13d670604d050
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 58282054
......@@ -789,6 +789,28 @@ QList<Abi::OSFlavor> Abi::flavorsForOs(const Abi::OS &o)
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()
{
Architecture arch = QTC_CPU; // define set by qmake
......@@ -798,20 +820,8 @@ Abi Abi::hostAbi()
#if defined (Q_OS_WIN)
os = WindowsOS;
#if _MSC_VER >= 1910
subos = WindowsMsvc2017Flavor;
#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;
#ifdef _MSC_VER
subos = flavorForMsvcVersion(_MSC_VER);
#elif defined (Q_CC_MINGW)
subos = WindowsMSysFlavor;
#endif
......
......@@ -139,6 +139,7 @@ public:
static QString toString(int w);
static QList<OSFlavor> flavorsForOs(const OS &o);
static OSFlavor flavorForMsvcVersion(int version);
static Abi hostAbi();
static QList<Abi> abisOfBinary(const Utils::FileName &path);
......
......@@ -269,11 +269,19 @@ static QList<Abi> guessGccAbi(const QString &m, const QByteArray &macros)
Abi::OSFlavor flavor = guessed.osFlavor();
Abi::BinaryFormat format = guessed.binaryFormat();
int width = guessed.wordWidth();
const QByteArray mscVer = "#define _MSC_VER ";
if (macros.contains("#define __SIZEOF_SIZE_T__ 8"))
width = 64;
else if (macros.contains("#define __SIZEOF_SIZE_T__ 4"))
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) {
// Apple does PPC and x86!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment