forked from qt-creator/qt-creator
Clang: Don't set a translation unit dirty if the main file is deleted
If a file is deleted the translation unit should be not updated. It will be later removed anyway. Task-number: QTCREATORBUG-15070 Change-Id: I40c9c70629dab1d35b713d54442ffdbb2df3db43 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -213,7 +213,7 @@ const QSet<Utf8String> &TranslationUnit::dependedFilePaths() const
|
||||
|
||||
void TranslationUnit::setDirtyIfDependencyIsMet(const Utf8String &filePath)
|
||||
{
|
||||
if (d->dependedFilePaths.contains(filePath)) {
|
||||
if (d->dependedFilePaths.contains(filePath) && isMainFileAndExistsOrIsOtherFile(filePath)) {
|
||||
d->needsToBeReparsed = true;
|
||||
d->hasNewDiagnostics = true;
|
||||
}
|
||||
@@ -249,6 +249,14 @@ bool TranslationUnit::projectPartIsOutdated() const
|
||||
return d->projectPart.lastChangeTimePoint() >= d->lastProjectPartChangeTimePoint;
|
||||
}
|
||||
|
||||
bool TranslationUnit::isMainFileAndExistsOrIsOtherFile(const Utf8String &filePath) const
|
||||
{
|
||||
if (filePath == d->filePath)
|
||||
return QFileInfo::exists(d->filePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TranslationUnit::createTranslationUnitIfNeeded() const
|
||||
{
|
||||
if (!d->translationUnit) {
|
||||
|
||||
Reference in New Issue
Block a user