Commit a102ee07 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Allow avoiding supportive translation unit for debugging



...by providing QTC_CLANG_NO_SUPPORTIVE_TRANSLATIONUNIT=1 in the run
environment.

Change-Id: If4e92521dfbc2752e4446e7037876d28683c1f66
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent f911ddba
......@@ -55,6 +55,12 @@
#include <QCoreApplication>
#include <QDebug>
static bool useSupportiveTranslationUnit()
{
static bool use = !qEnvironmentVariableIntValue("QTC_CLANG_NO_SUPPORTIVE_TRANSLATIONUNIT");
return use;
}
namespace ClangBackEnd {
ClangCodeModelServer::ClangCodeModelServer()
......@@ -116,9 +122,7 @@ void ClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslati
// we might block the translation unit for a completion request
// that comes right after this message.
updateDocumentAnnotationsTimer.start(0);
QTimer::singleShot(0, [this, updateDocuments](){
startInitializingSupportiveTranslationUnits(updateDocuments);
});
delayStartInitializingSupportiveTranslationUnits(updateDocuments);
}
} catch (const std::exception &exception) {
qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what();
......@@ -329,6 +333,16 @@ void ClangCodeModelServer::processInitialJobsForDocuments(const std::vector<Docu
}
}
void ClangCodeModelServer::delayStartInitializingSupportiveTranslationUnits(
const std::vector<Document> &documents)
{
if (useSupportiveTranslationUnit()) {
QTimer::singleShot(0, [this, documents](){
startInitializingSupportiveTranslationUnits(documents);
});
}
}
void ClangCodeModelServer::startInitializingSupportiveTranslationUnits(
const std::vector<Document> &documents)
{
......
......@@ -72,6 +72,7 @@ private:
void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath);
void processInitialJobsForDocuments(const std::vector<Document> &documents);
void delayStartInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
void startInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
void processJobsForDirtyAndVisibleDocuments();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment