Clang: Print cmd line equivalent if using QTC_CLANG_VERBOSE

...so we can easily check if the bug is in (lib)clang itself.

Change-Id: Id6dfd8014efc1c7704265b99697f19ab990286a7
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-03-14 12:02:42 -03:00
parent cbf98ba819
commit 332caf38be

View File

@@ -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();
}