forked from qt-creator/qt-creator
CppTools: Turn some classes into pure value types
ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers to Project and/or Toolchain, even though they were used in contexts where these pointers were either unsafe to access or not guaranteed to be valid anymore, which made their use difficult and error-prone. We turn these classes into pure value types by copying in all relevant information before the first async operation takes place. Fixes: QTCREATORBUG-25678 Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <cplusplus/Icons.h>
|
||||
|
||||
#include <cpptools/projectpart.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
#include <cpptools/compileroptionsbuilder.h>
|
||||
|
||||
#include <QPair>
|
||||
@@ -38,20 +38,26 @@ class QTextBlock;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CppTools {
|
||||
class ClangDiagnosticConfig;
|
||||
class CppEditorDocumentHandle;
|
||||
class ProjectInfo;
|
||||
}
|
||||
|
||||
namespace ClangBackEnd { class TokenInfoContainer; }
|
||||
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
CppTools::CppEditorDocumentHandle *cppDocument(const QString &filePath);
|
||||
void setLastSentDocumentRevision(const QString &filePath, uint revision);
|
||||
|
||||
QPair<Utils::Id, QStringList> createClangOptions(const CppTools::ProjectPart &projectPart,
|
||||
const QString &filePath);
|
||||
CppTools::ClangDiagnosticConfig warningsConfigForProject(ProjectExplorer::Project *project);
|
||||
const QStringList optionsForProject(ProjectExplorer::Project *project);
|
||||
|
||||
QStringList createClangOptions(const CppTools::ProjectPart &projectPart, const QString &filePath,
|
||||
const CppTools::ClangDiagnosticConfig &warningsConfig,
|
||||
const QStringList &projectOptions);
|
||||
|
||||
CppTools::ProjectPart::Ptr projectPartForFile(const QString &filePath);
|
||||
CppTools::ProjectPart::Ptr projectPartForFileBasedOnProcessor(const QString &filePath);
|
||||
@@ -79,8 +85,9 @@ public:
|
||||
};
|
||||
|
||||
enum class CompilationDbPurpose { Project, CodeModel };
|
||||
GenerateCompilationDbResult generateCompilationDB(CppTools::ProjectInfo projectInfo,
|
||||
CompilationDbPurpose purpose);
|
||||
GenerateCompilationDbResult generateCompilationDB(const CppTools::ProjectInfo::Ptr projectInfo,
|
||||
CompilationDbPurpose purpose, const CppTools::ClangDiagnosticConfig &warningsConfig,
|
||||
const QStringList &projectOptions);
|
||||
|
||||
class DiagnosticTextInfo
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user