forked from qt-creator/qt-creator
ClangCodeModel: fix null pointer access
Change-Id: I2c9e4dc04b7b27986eb0a3a74d8fa6879715df87 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
committed by
Christian Kandeler
parent
14938b3881
commit
938e9cab0f
@@ -427,9 +427,15 @@ static bool isProjectDataUpToDate(
|
||||
return false;
|
||||
if (sessionModeEnabled() && project)
|
||||
return false;
|
||||
const ProjectInfoList newProjectInfo = project
|
||||
? ProjectInfoList{CppModelManager::instance()->projectInfo(project)}
|
||||
: CppModelManager::instance()->projectInfos();
|
||||
ProjectInfoList newProjectInfo;
|
||||
if (project) {
|
||||
if (const ProjectInfo::ConstPtr pi = CppModelManager::instance()->projectInfo(project))
|
||||
newProjectInfo.append(pi);
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
newProjectInfo = CppModelManager::instance()->projectInfos();
|
||||
}
|
||||
if (newProjectInfo.size() != projectInfo.size())
|
||||
return false;
|
||||
for (int i = 0; i < projectInfo.size(); ++i) {
|
||||
@@ -450,8 +456,10 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
|
||||
if (sessionModeEnabled()) {
|
||||
project = nullptr;
|
||||
projectInfo = CppModelManager::instance()->projectInfos();
|
||||
} else if (const ProjectInfo::ConstPtr pi = CppModelManager::instance()->projectInfo(project)) {
|
||||
projectInfo.append(pi);
|
||||
} else {
|
||||
projectInfo.append(CppModelManager::instance()->projectInfo(project));
|
||||
return;
|
||||
}
|
||||
|
||||
const Utils::FilePath jsonDbDir = getJsonDbDir(project);
|
||||
|
@@ -166,8 +166,9 @@ GenerateCompilationDbResult generateCompilationDB(QList<ProjectInfo::ConstPtr> p
|
||||
const UsePrecompiledHeaders usePch = getPchUsage();
|
||||
const QJsonArray jsonProjectOptions = QJsonArray::fromStringList(projectOptions);
|
||||
for (const ProjectInfo::ConstPtr &projectInfo : std::as_const(projectInfoList)) {
|
||||
QTC_ASSERT(projectInfo, continue);
|
||||
for (ProjectPart::ConstPtr projectPart : projectInfo->projectParts()) {
|
||||
QTC_ASSERT(projectInfo, continue);
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
QStringList args;
|
||||
const CompilerOptionsBuilder optionsBuilder = clangOptionsBuilder(
|
||||
*projectPart, warningsConfig, clangIncludeDir, {});
|
||||
|
Reference in New Issue
Block a user