CompilationDatabaseProjectManager: Be more careful with filtering

Do not blindly remove all flags that contain the file's base name.

Fixes: QTCREATORBUG-27990
Change-Id: Ib51b65a8694e82ec22af859176b0db0e5d86b5f0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2022-08-01 14:37:30 +02:00
parent b52177119f
commit 98a39401db
3 changed files with 26 additions and 14 deletions

View File

@@ -177,7 +177,7 @@ static QStringList jsonObjectFlags(const QJsonObject &object, QSet<QString> &fla
return flags;
}
static FilePath jsonObjectFilename(const QJsonObject &object)
static FilePath jsonObjectFilePath(const QJsonObject &object)
{
const QString workingDir = QDir::cleanPath(object["directory"].toString());
FilePath fileName = FilePath::fromString(QDir::cleanPath(object["file"].toString()));
@@ -204,10 +204,10 @@ std::vector<DbEntry> CompilationDbParser::readJsonObjects() const
}
const QJsonObject object = document.object();
const Utils::FilePath fileName = jsonObjectFilename(object);
const Utils::FilePath filePath = jsonObjectFilePath(object);
const QStringList flags = filterFromFileName(jsonObjectFlags(object, flagsCache),
fileName.baseName());
result.push_back({flags, fileName, object["directory"].toString()});
filePath.fileName());
result.push_back({flags, filePath, object["directory"].toString()});
objectStart = m_projectFileContents.indexOf('{', objectEnd + 1);
objectEnd = m_projectFileContents.indexOf('}', objectStart + 1);