forked from qt-creator/qt-creator
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 <david.schulz@qt.io>
This commit is contained in:
@@ -55,6 +55,12 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
static bool useSupportiveTranslationUnit()
|
||||||
|
{
|
||||||
|
static bool use = !qEnvironmentVariableIntValue("QTC_CLANG_NO_SUPPORTIVE_TRANSLATIONUNIT");
|
||||||
|
return use;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
ClangCodeModelServer::ClangCodeModelServer()
|
ClangCodeModelServer::ClangCodeModelServer()
|
||||||
@@ -116,9 +122,7 @@ void ClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslati
|
|||||||
// we might block the translation unit for a completion request
|
// we might block the translation unit for a completion request
|
||||||
// that comes right after this message.
|
// that comes right after this message.
|
||||||
updateDocumentAnnotationsTimer.start(0);
|
updateDocumentAnnotationsTimer.start(0);
|
||||||
QTimer::singleShot(0, [this, updateDocuments](){
|
delayStartInitializingSupportiveTranslationUnits(updateDocuments);
|
||||||
startInitializingSupportiveTranslationUnits(updateDocuments);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what();
|
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(
|
void ClangCodeModelServer::startInitializingSupportiveTranslationUnits(
|
||||||
const std::vector<Document> &documents)
|
const std::vector<Document> &documents)
|
||||||
{
|
{
|
||||||
|
@@ -72,6 +72,7 @@ private:
|
|||||||
void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath);
|
void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath);
|
||||||
|
|
||||||
void processInitialJobsForDocuments(const std::vector<Document> &documents);
|
void processInitialJobsForDocuments(const std::vector<Document> &documents);
|
||||||
|
void delayStartInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
|
||||||
void startInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
|
void startInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
|
||||||
|
|
||||||
void processJobsForDirtyAndVisibleDocuments();
|
void processJobsForDirtyAndVisibleDocuments();
|
||||||
|
Reference in New Issue
Block a user