Clang: forward clangbackend QDebug messages to stdout

...to see them in both qtcreator application output
and DebugView.
clangbackend is a separate process which provides
QtCreator stdout and stderr channels so we need to
have QDebug messages there in order to receive them.

Change-Id: I2edc4de1ca203b061395b0b3070e4471348eaad7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-01-08 10:24:01 +01:00
parent 32c938c4a0
commit 2c7823c975

View File

@@ -33,6 +33,8 @@
#include <clangcodemodelserver.h>
#include <clangcodemodelclientproxy.h>
#include <iostream>
using ClangBackEnd::ClangCodeModelClientProxy;
using ClangBackEnd::ClangCodeModelServer;
using ClangBackEnd::ConnectionServer;
@@ -53,8 +55,20 @@ QString processArguments(QCoreApplication &application)
return parser.positionalArguments().first();
}
#ifdef Q_OS_WIN
static void messageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg)
{
std::wcout << msg.toStdWString() << std::endl;
if (type == QtFatalMsg)
abort();
}
#endif
int main(int argc, char *argv[])
{
#ifdef Q_OS_WIN
qInstallMessageHandler(messageOutput);
#endif
QLoggingCategory::setFilterRules(QStringLiteral("qtc.*.debug=false"));
QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));