Clang: Reparse editor document on project change

Change-Id: If7dcdc370fd50fded996df80ab6c893b4ec1ad55
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-12-07 13:37:02 +01:00
parent d7a0268610
commit 0985e67858
8 changed files with 84 additions and 15 deletions

View File

@@ -276,13 +276,16 @@ const QSet<Utf8String> &TranslationUnit::dependedFilePaths() const
return d->dependedFilePaths;
}
void TranslationUnit::setDirtyIfProjectPartIsOutdated()
{
if (projectPartIsOutdated())
setDirty();
}
void TranslationUnit::setDirtyIfDependencyIsMet(const Utf8String &filePath)
{
if (d->dependedFilePaths.contains(filePath) && isMainFileAndExistsOrIsOtherFile(filePath)) {
d->needsToBeReparsed = true;
d->hasNewDiagnostics = true;
d->hasNewHighlightingInformations = true;
}
if (d->dependedFilePaths.contains(filePath) && isMainFileAndExistsOrIsOtherFile(filePath))
setDirty();
}
SourceLocation TranslationUnit::sourceLocationAt(uint line, uint column) const
@@ -369,6 +372,13 @@ bool TranslationUnit::projectPartIsOutdated() const
return d->projectPart.lastChangeTimePoint() >= d->lastProjectPartChangeTimePoint;
}
void TranslationUnit::setDirty()
{
d->needsToBeReparsed = true;
d->hasNewDiagnostics = true;
d->hasNewHighlightingInformations = true;
}
bool TranslationUnit::isMainFileAndExistsOrIsOtherFile(const Utf8String &filePath) const
{
if (filePath == d->filePath)