diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-07-28 16:44:39 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-07-29 08:53:18 +0000 |
commit | 3b314e50c8009e1140da255fadc50eb9cb8d295e (patch) | |
tree | 0cde1bf006da70a4ba3612587d4e05e510cde3c4 | |
parent | 92ff2678453ee88dade133f0568ae6ace1fa4e57 (diff) | |
download | qt-creator-3b314e50c8009e1140da255fadc50eb9cb8d295e.tar.gz |
Clang: Suppress printing diagnostics by default
Triggering completion happens often on invalid code, which leads to
diagnostics from libclang. Suppress those by default, but allow to
inspect them with the logging category:
qtc.clangbackend.verboselib=true
Change-Id: I802ae58fe1b5244f3228ee73a181ea362de20608
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
-rw-r--r-- | src/tools/clangbackend/ipcsource/translationunit.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/clangbackend/ipcsource/translationunit.cpp b/src/tools/clangbackend/ipcsource/translationunit.cpp index bfbfb9ec74..9581cb5750 100644 --- a/src/tools/clangbackend/ipcsource/translationunit.cpp +++ b/src/tools/clangbackend/ipcsource/translationunit.cpp @@ -40,6 +40,9 @@ #include <utf8string.h> #include <QFileInfo> +#include <QLoggingCategory> + +static Q_LOGGING_CATEGORY(verboseLibLog, "qtc.clangbackend.verboselib"); namespace ClangBackEnd { @@ -107,8 +110,10 @@ CXIndex TranslationUnit::index() const { checkIfNull(); - if (!d->index) - d->index = clang_createIndex(1, 1); + if (!d->index) { + const bool displayDiagnostics = verboseLibLog().isDebugEnabled(); + d->index = clang_createIndex(1, displayDiagnostics); + } return d->index; } |