forked from qt-creator/qt-creator
Clang: Fix parsing MSVC's crtdefs.h for 64 Bit
...by specifying the word width, as for the Clang Static Analyzer. This has gone unnoticed so far because it looks like that the error diagnostic from the bug report can be extracted with libclang (as shown in the info bar), but is not printed from libclang or clang.exe itself. Task-number: QTCREATORBUG-17130 Change-Id: Ia7a5ee3825c7211cdf80c2166a9eb454ce48cac1 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -87,6 +87,14 @@ void CompilerOptionsBuilder::addDefine(const QByteArray &defineDirective)
|
||||
m_options.append(defineDirectiveToDefineOption(defineDirective));
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addWordWidth()
|
||||
{
|
||||
const QString argument = m_projectPart.toolChainWordWidth == ProjectPart::WordWidth64Bit
|
||||
? QLatin1String("-m64")
|
||||
: QLatin1String("-m32");
|
||||
add(argument);
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addTargetTriple()
|
||||
{
|
||||
if (!m_projectPart.targetTriple.isEmpty()) {
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
void addDefine(const QByteArray &defineDirective);
|
||||
|
||||
// Add options based on project part
|
||||
void addWordWidth();
|
||||
virtual void addTargetTriple();
|
||||
virtual void enableExceptions();
|
||||
void addHeaderPathOptions();
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace CppTools {
|
||||
|
||||
ProjectPart::ProjectPart()
|
||||
: project(0)
|
||||
, toolChainWordWidth(WordWidth32Bit)
|
||||
, isMsvc2015Toolchain(false)
|
||||
, languageVersion(CXX14)
|
||||
, languageExtensions(NoExtensions)
|
||||
|
||||
@@ -81,6 +81,11 @@ public: // Types
|
||||
Qt5 = 2
|
||||
};
|
||||
|
||||
enum ToolChainWordWidth {
|
||||
WordWidth32Bit,
|
||||
WordWidth64Bit,
|
||||
};
|
||||
|
||||
using Ptr = QSharedPointer<ProjectPart>;
|
||||
|
||||
|
||||
@@ -103,6 +108,7 @@ public: // fields
|
||||
QByteArray projectDefines;
|
||||
QByteArray toolchainDefines;
|
||||
Core::Id toolchainType;
|
||||
ToolChainWordWidth toolChainWordWidth;
|
||||
bool isMsvc2015Toolchain;
|
||||
QString targetTriple;
|
||||
ProjectPartHeaderPaths headerPaths;
|
||||
|
||||
@@ -343,6 +343,9 @@ void ProjectPartBuilder::evaluateProjectPartToolchain(
|
||||
projectPart->toolchainType = toolChain->typeId();
|
||||
projectPart->isMsvc2015Toolchain
|
||||
= toolChain->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMsvc2015Flavor;
|
||||
projectPart->toolChainWordWidth = toolChain->targetAbi().wordWidth() == 64
|
||||
? ProjectPart::WordWidth64Bit
|
||||
: ProjectPart::WordWidth32Bit;
|
||||
projectPart->targetTriple = targetTriple(projectPart->project, toolChain->typeId());
|
||||
projectPart->updateLanguageFeatures();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user