ClangCodeModel: Speed up compilation db generation

We needlessly re-evaluated the same compiler options again and again for
all files in a project part.
Now we only do the actual file-related work per file. Along the way, we
dissolved some unneeded classes and made CompilerOptionsBuilder non-
polymorphic.

Change-Id: I9710d641a57032936cc0812515974dbc91676c8c
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-05-04 16:48:48 +02:00
parent ae93978af1
commit 7ef5001076
9 changed files with 104 additions and 191 deletions

View File

@@ -57,11 +57,14 @@ CppEditor::CppEditorDocumentHandle *cppDocument(const QString &filePath);
void setLastSentDocumentRevision(const QString &filePath, uint revision);
CppEditor::ClangDiagnosticConfig warningsConfigForProject(ProjectExplorer::Project *project);
const QStringList optionsForProject(ProjectExplorer::Project *project);
const QStringList optionsForProject(ProjectExplorer::Project *project,
const CppEditor::ClangDiagnosticConfig &warningsConfig);
QStringList createClangOptions(const CppEditor::ProjectPart &projectPart, const QString &filePath,
const CppEditor::ClangDiagnosticConfig &warningsConfig,
const QStringList &projectOptions);
CppEditor::CompilerOptionsBuilder clangOptionsBuilder(
const CppEditor::ProjectPart &projectPart,
const CppEditor::ClangDiagnosticConfig &warningsConfig);
QStringList clangOptionsForFile(CppEditor::CompilerOptionsBuilder optionsBuilder,
const QString &filePath, const QStringList &projectOptions);
CppEditor::ProjectPart::ConstPtr projectPartForFile(const QString &filePath);
CppEditor::ProjectPart::ConstPtr projectPartForFileBasedOnProcessor(const QString &filePath);