Clang: Don't analyze same file multiple times

Diagnostics do not depend much on project parts. But
having the same file twice can result in duplicated
diagnostics which later can cause the same fix-it
being applied twice and getting corrupted code.

Change-Id: Ie2809af7a54034b05df9383875f7c3123aea58e8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-06-28 10:16:48 +02:00
parent 66a271a150
commit be3e848c0f
4 changed files with 19 additions and 7 deletions

View File

@@ -78,13 +78,13 @@ static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::Ptr> &proj
continue;
if (CppTools::ProjectFile::isSource(file.kind)) {
const FileInfo info{Utils::FileName::fromString(file.path), file.kind, projectPart};
fileInfos.append(info);
fileInfos.emplace_back(Utils::FileName::fromString(file.path), file.kind, projectPart);
}
}
}
Utils::sort(fileInfos, &FileInfo::file);
fileInfos.erase(std::unique(fileInfos.begin(), fileInfos.end()), fileInfos.end());
return fileInfos;
}