From 636faf30db175784814a2c5d1df3abc8829dc017 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 18 Jan 2024 11:10:39 +0100 Subject: [PATCH 1/2] CppEditor: Do not look for unnamed function parameters in comments Task-number: QTCREATORBUG-30155 Change-Id: Idc0c7b7c68c99ffda52a4fee2c3dfe5ee52ce099 Reviewed-by: Reviewed-by: David Schulz Reviewed-by: Qt CI Bot --- src/plugins/cppeditor/cppfunctiondecldeflink.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 7055b00d038..f64e5df9e4a 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(); From 5e6f1f5dacf2f92635b81497b02ed73e6e7ea9af Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 17 Jan 2024 20:11:02 +0100 Subject: [PATCH 2/2] CMakePM: Fix adding qml files to targets using ${PROJECT_NAME} Instead of looking after the target name reported by CMake's file api e.g. mytarget, take the parameter name from the function that created the target. This way if the user used ${PROJECT_NAME} to mark the name of the target for qt_add_executable and qt_add_qml_module, when adding a qml file the proper function would be picked. Fixes: QTCREATORBUG-30218 Change-Id: I920f16d9f5a6b8a7a2fddb3ef7e97e0e3bccd464 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 9ed58160eaf..a9856ae7b77 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -324,7 +324,7 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP // Special case: when qt_add_executable and qt_add_qml_module use the same target name // then qt_add_qml_module function should be used - const std::string target_name = targetName.toStdString(); + const std::string target_name = function->Arguments().front().Value; auto add_qml_module_func = std::find_if(cmakeListFile.Functions.begin(), cmakeListFile.Functions.end(),