diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index 6c33082be0a..c7a52daefcb 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -275,10 +275,9 @@ static QString newFilesForFunction(const std::string &cmakeFunction,
static std::optional cmakeFileForBuildKey(const QString &buildKey,
const QList &targets)
{
- auto target = Utils::findOrDefault(targets,
- [buildKey](const CMakeBuildTarget &target) {
- return target.title == buildKey;
- });
+ auto target = Utils::findOrDefault(targets, [buildKey](const CMakeBuildTarget &target) {
+ return target.title == buildKey;
+ });
if (target.backtrace.isEmpty()) {
qCCritical(cmakeBuildSystemLog) << "target.backtrace for" << buildKey << "is empty."
<< "The location where to add the files is unknown.";
@@ -658,7 +657,7 @@ bool CMakeBuildSystem::addSrcFiles(Node *context, const FilePaths &filePaths, Fi
return false;
}
- const std::string target_name = targetName.toStdString();
+ const std::string target_name = function->Arguments().front().Value;
auto qtAddModule = [target_name](const auto &func) {
return (func.LowerCaseName() == "qt_add_qml_module"
|| func.LowerCaseName() == "qt6_add_qml_module")
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index 4c300012724..f6e83669144 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -863,6 +863,8 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse
const QStringView docView = QStringView(content);
for (auto it = renamedTargetParameters.cbegin();
it != renamedTargetParameters.cend(); ++it) {
+ if (!it.key()->name())
+ continue;
const QString paramName = Overview().prettyName(it.key()->name());
for (const Token &tok : functionComments) {
const TranslationUnit * const tu = targetFile->cppDocument()->translationUnit();