summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/clangcodemodel')
-rw-r--r--src/plugins/clangcodemodel/clangutils.cpp5
-rw-r--r--src/plugins/clangcodemodel/cppcreatemarkers.cpp15
2 files changed, 19 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp
index dae5f1a835..79348e44bd 100644
--- a/src/plugins/clangcodemodel/clangutils.cpp
+++ b/src/plugins/clangcodemodel/clangutils.cpp
@@ -113,6 +113,11 @@ static QStringList buildDefines(const QByteArray &defines, bool toolchainDefines
if (def.isEmpty())
continue;
+ // This is a quick fix for QTCREATORBUG-11501.
+ // TODO: do a proper fix, see QTCREATORBUG-11709.
+ if (def.startsWith("#define __cplusplus"))
+ continue;
+
// TODO: verify if we can pass compiler-defined macros when also passing -undef.
if (toolchainDefines) {
//### FIXME: the next 3 check shouldn't be needed: we probably don't want to get the compiler-defined defines in.
diff --git a/src/plugins/clangcodemodel/cppcreatemarkers.cpp b/src/plugins/clangcodemodel/cppcreatemarkers.cpp
index aadf3b6b7e..5cbac36dda 100644
--- a/src/plugins/clangcodemodel/cppcreatemarkers.cpp
+++ b/src/plugins/clangcodemodel/cppcreatemarkers.cpp
@@ -32,6 +32,7 @@
#include <cplusplus/CppDocument.h>
#include <cpptools/cppmodelmanagerinterface.h>
+#include <utils/hostosinfo.h>
#include <utils/runextensions.h>
#include <QCoreApplication>
@@ -84,6 +85,17 @@ CreateMarkers::CreateMarkers(SemanticMarker::Ptr semanticMarker,
CreateMarkers::~CreateMarkers()
{ }
+static QString commandLine(const QStringList &options, const QString &fileName)
+{
+ const QStringList allOptions = QStringList(options)
+ << QLatin1String("-fsyntax-only") << fileName;
+ QStringList allOptionsQuoted;
+ foreach (const QString &option, allOptions)
+ allOptionsQuoted.append(QLatin1Char('\'') + option + QLatin1Char('\''));
+ return ::Utils::HostOsInfo::withExecutableSuffix(QLatin1String("clang"))
+ + QLatin1Char(' ') + allOptionsQuoted.join(QLatin1String(" "));
+}
+
void CreateMarkers::run()
{
QMutexLocker lock(m_marker->mutex());
@@ -95,7 +107,8 @@ void CreateMarkers::run()
QTime t;
if (DebugTiming) {
qDebug() << "*** Highlighting from" << m_firstLine << "to" << m_lastLine << "of" << m_fileName;
- qDebug() << "***** Options: " << m_options.join(QLatin1String(" "));
+ qDebug("***** Options (cmd line equivalent): %s",
+ commandLine(m_options, m_fileName).toUtf8().constData());
t.start();
}