forked from qt-creator/qt-creator
Clang: Introduce DocumentParsed as job requirement
This is in prepration for a follow-up change, which introduces a state where the Document is not yet parsed (it was reset) but the queue has jobs. All jobs get this requirement except those that generate an AST. Change-Id: Ifcbb704e54108b40797180514c5ad3f3768ef10b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -247,6 +247,12 @@ bool JobQueue::areRunConditionsMet(const JobRequest &request, const Document &do
|
||||
}
|
||||
}
|
||||
|
||||
if (conditions.testFlag(Condition::DocumentParsed)
|
||||
&& !document.translationUnits().hasParsedTranslationUnit()) {
|
||||
qCDebugJobs() << "Not choosing due to not yet parsed translation unit:" << request;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,9 @@ static JobRequest::RunConditions conditionsForType(JobRequest::Type type)
|
||||
if (type == Type::RequestReferences)
|
||||
conditions |= Condition::CurrentDocumentRevision;
|
||||
|
||||
if (type != Type::UpdateDocumentAnnotations && type != Type::ParseSupportiveTranslationUnit)
|
||||
conditions |= Condition::DocumentParsed;
|
||||
|
||||
return conditions;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ public:
|
||||
DocumentNotVisible = 1 << 2,
|
||||
DocumentSuspended = 1 << 3,
|
||||
DocumentUnsuspended = 1 << 4,
|
||||
CurrentDocumentRevision = 1 << 5,
|
||||
DocumentParsed = 1 << 5,
|
||||
CurrentDocumentRevision = 1 << 6,
|
||||
};
|
||||
Q_DECLARE_FLAGS(RunConditions, RunCondition)
|
||||
|
||||
|
||||
@@ -111,6 +111,13 @@ bool TranslationUnits::areAllTranslationUnitsParsed() const
|
||||
});
|
||||
}
|
||||
|
||||
bool TranslationUnits::hasParsedTranslationUnit() const
|
||||
{
|
||||
return Utils::anyOf(m_units, [](const TranslationUnitDataPtr &unit) {
|
||||
return unit->parseTimePoint != TimePoint();
|
||||
});
|
||||
}
|
||||
|
||||
int TranslationUnits::size() const
|
||||
{
|
||||
return m_units.size();
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
void updateParseTimePoint(const Utf8String &translationUnitId, TimePoint timePoint);
|
||||
|
||||
bool areAllTranslationUnitsParsed() const;
|
||||
bool hasParsedTranslationUnit() const;
|
||||
|
||||
public: // for tests
|
||||
int size() const;
|
||||
|
||||
Reference in New Issue
Block a user