summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Scene3DItem: fix screen flickering when using OnDemandPaul Lemire2022-12-202-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using OnDemand, we detect whether Qt3D actually needs to render or not. Based on that we set a flag on the Scene3DRenderer to tell it whether it should render or not. The subtlety lies in the fact that depending on that flag value, we will still call Qt3D render but not at the same moment. We need to call render to unlock the Qt3D render loop for next frame. Therefore when we should skip a frame, we call render in Scene3DRender::beforeSynchronize (updatePaintNode) and return early while in the other case beforeSynchronize doesn't call render and it gets called later in beforeRenderPassRecording. We know that the render call in the skip frame case won't render anything. To work correctly, we must obviously set the skip frame flag before beforeSynchronize / beforeRenderPassRecording is called which wasn't the case. This therefore resulted in random screen flashing as we would end up having beforeSynchronize rely on the skip frame value for the previous frame. This means we would end up issuing a render call in beforeSynchronize using assuming it wouldn't render anything when it actually did (no FBO would be bound and Qt3D would render straight to the window ...) Also update the number of frames to render before skipping to 3 to match Qt 5.15 and ensure we have something visible for the first time Scene3D is launched. Change-Id: Icc34b62a0af2ff44232b39c694a4702488a890a2 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit e2aac33d04804c3c8f4f554c206a8cb9dd14611e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix compilation of manual testsPaul Lemire2022-12-202-3/+3
| | | | | | | | | | | | | - Disable the examples that use QtMultimedia as they haven't been ported to QtMultimedia from Qt6 - QTextureDataUpdate forward header doesn't seem to be generated - Add QuickWidgets in the find_package call so that we can later check if it is actually available Change-Id: I98d000e839dd0cb0aad862b66bfe8b9725a13744 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit aee00ddfb3650325df8f67b68885828b0669a017) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qtexturedataupdate.h: fix namespace declaration for syncqt to workPaul Lemire2022-12-201-2/+1
| | | | | | | | | | syncqt doesn't find the class name if the namespace line doesn't end with {. Change-Id: Icf30464ed0ecb9ce84d6c62c04edfc5d374ed26f Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit df4665a61fc84b6d6a952034c7d758394ebc1767) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip tst_raycasting on QNXVille Voutilainen2022-12-191-0/+8
| | | | | | | | Task-number: QTBUG-107694 Change-Id: I4028dc107427c955342903239d4d80674e7109e4 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 0f1c9494899e94d86785b12c8c60743d2e829a58) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* LoadSceneJob: don't risk to leak the loaded subtreeAurélien Brooke2022-12-182-3/+4
| | | | | | | | | | | | | | | There is a risk that the front-end QSceneLoader node has been destroyed by the time the LoadSceneJob completes. The postFrame() would then do nothing, and the m_sceneSubtree pointer will be forgotten, leaking the whole tree. This can happen in real life when loading very large scenes. To ensure that we cannot leak the scene tree, use strict pointer ownership with std::unique_ptr. Change-Id: Ie2281bc178fc8793bab967a13ea8d30aa46268a0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit be8b6796c17cd1a616975bbd24f7a0cead725a48) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.5' in qt/qt3dv6.5.0-beta1Qt Submodule Update Bot2022-12-161-4/+4
| | | | | Change-Id: I91cc6e420e16bbc64a29485c88702277186b2a52 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* tst_renderviews: fix signed/unsigned mismatchMarc Mutz2022-12-161-4/+4
| | | | | | | | | Amends f672753556cf28d44f864457dc6338a55e2e0ed4. Change-Id: I5c3e99a033cead91a03ab468b4c44b687422baac Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit dfcd9f8b5aa56973e4a000331e51c4e9386ec78d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_filtercompatibletechniquejob: fix signed/unsigned mismatchMarc Mutz2022-12-161-1/+1
| | | | | | | | | Amends 914752257634dede18cc5079f2a506b699744058. Change-Id: I0320fb3b5e44e10e6ee106bbcb79322323cc3d12 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit cc81a2f1c2cb5d4c1da4a03d8fde90230584edd1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_pickboundingvolumejob: fix signed/unsigned mismatchMarc Mutz2022-12-161-2/+2
| | | | | | | | | Amends fd7536a6e4cfaee8e52c9c6411601aed745fe5f6. Change-Id: Ib2aed78b798ea163125593319f65b123bcc4f895 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 90fb8a94b438d9aed27b8cf5f020b92891cce749) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Handle nullptr returned from the shader managerMartin Andersson2022-12-161-0/+3
| | | | | | | | | Sometimes the shader manager returns a nullptr when fetching the shader from a handle, so the return value needs to be checked before it is accessed. Change-Id: Ia021cd8f22ceb2626a7a2734b7e346fbcc8e0301 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit bffdaabaa5cd9d7fdc64e4124817b504319708e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* RHI renderer: fix crash in Renderer::sendShaderChangesToFrontend()Aurélien Brooke2022-12-161-0/+6
| | | | | | | | | | | | | | | | The Shaders or the QShaderProgramBuilders may not exist in the managers anymore by the time we arrive in Renderer::sendShaderChangesToFrontend(). This happens when Qt3D shuts down. To fix this, check the returned values by the managers. This is similar to the existing patch for the OpenGL renderer: Ia021cd8f22ceb2626a7a2734b7e346fbcc8e0301 Change-Id: I322bf2524016c1f98433891ad230b65272fabbdd Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 643d7889cc39f5410b9ccf64c05db0f7f6cc51fc)
* RHIResourceManagers: fix the leak of RHIShaderAurélien Brooke2022-12-161-1/+1
| | | | | | | | | | | | | | The Renderer seems to already take care of deleting the abandoned shaders thanks to the APIShaderManager::purge() method. However, when Qt3D is shut down, there remain active RHIShaders in the RHIShaderManager::m_apiShaders, that nobody deletes. To fix this, in the RHIResourceManagers, delete the remaining RHIShaders as we do with the other RHI resources. Change-Id: Iccc5470831eb7df0e120db6864fae425005c6919 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 1fe1c5a3752d1d56e78fdeb95842520d83940e52)
* Scene3DItem: fix assert when changing windowAurélien Brooke2022-12-161-1/+6
| | | | | | | | | | | | | | | In Scene3DItem::updatePaintNode(), in the Render thread, we try to set the parent of the aspect engine being deleted to nullptr. This was triggering an assert in QCoreApplication::sendEvent(), since the aspect engine lives in a different thread, the Main thread. Don't trigger this assert by avoiding to send ChildAdded/ChildRemoved events when reparenting the aspect manager, thanks to the QQml_setParent_noEvent utility. Change-Id: Ic816701ee65654f7b18b4998c54feb4840af0a14 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 63a9c3e314364765437f641454637611c2479672)
* check bounding volumes for validity in concurrent reduction stepChristian Riggenbach2022-12-161-3/+5
| | | | | | | | | | | The multithreaded job doesn't check the visited bounding volumes for validity before adding them to the list to process further. This leads to crashes, namely nullptr-dereferences. Fixes: QTBUG-108405 Change-Id: I16a7c008c7ac4f04be40bdbba05d8c745c1c825e Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 23a0432451cab1e434df0efda391dbeb4790e9f0)
* Update dependencies on '6.5' in qt/qt3dQt Submodule Update Bot2022-12-141-2/+2
| | | | | Change-Id: I4b540334dfd5be26df294f13fa2ce6151be83804 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.5' in qt/qt3dQt Submodule Update Bot2022-12-131-4/+4
| | | | | Change-Id: I1f593ab02d7c143c9fe493a72e57e4d5c9d00657 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Disable qresourcemanager test on QEMUMike Krus2022-12-131-1/+5
| | | | | | | | | | It's flaky ... Task-number: QTBUG-107693 Change-Id: I67cbb5ef8800f5c29e33ae17241b04b3af0ed067 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 4e728a2d3248b7c068b0c9b7cf1e38b3493bc3d6) Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-12-121-4/+4
| | | | | Change-Id: Id06318bfa759e14a16a988b7424660fb2709d873 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-12-091-4/+4
| | | | | Change-Id: Iaa4793e4b7b5ac4c00faa55aa82b97cd3e20a040 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* cmake: make qt3d-vulkan feature depends on vulkan in QtGuiLiang Qi2022-12-071-1/+1
| | | | | | | Fixes: QTBUG-109203 Pick-to: 6.4 6.2 Change-Id: Ib707a6d09cf95e9eb819205660bb185fba398705 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Fix paths for Files property in qt_attribution.json filesKai Köhne2022-12-071-1/+1
| | | | | | | | qtattributionsscanner expects file paths to be separated by a space. Pick-to: 6.2 6.4 Change-Id: I983870ea403983f2fc32bf0d986e76235d74e497 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Mark the module free of qAsConst()Marc Mutz2022-12-071-0/+2
| | | | | Change-Id: I914ccc09297ac6283d7cf24d5afc96ebdaf294d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-12-051-4/+4
| | | | | Change-Id: I72a81bf30af86ab2e405fc0092ff48a2a98a6034 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix "Assigning instead of Comparing" in tst_QResourceManagerAurélien Brooke2022-11-301-1/+1
| | | | | | | | | | Fix "Assigning instead of Comparing" in tst_QResourceManager::heavyDutyMultiThreadedAccess() Task-number: QTBUG-107693 Pick-to: 6.4 Change-Id: I018bf83dc7a3cc9d6faa654a73b2d460c3e4498a Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-301-2/+2
| | | | | Change-Id: Idf9bb93e10d4769af0713004862ac6253dffac76 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* RHI: Fix memory leak in RenderCommandTasuku Suzuki2022-11-292-0/+7
| | | | | | | | | allocated in Renderer::setBindingAndShaderResourcesForCommand Pick-to: 6.4 Task-number: QTBUG-106972 Change-Id: I4d0a64f1fbb0e9037b1e4c930f91e1b55412f180 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-271-4/+4
| | | | | Change-Id: I7809594164b38cac034c276c8a19b54c243f5617 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-261-4/+4
| | | | | Change-Id: Iac35a536e58f719f6ef76988480f7c8fc58aa5b1 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* CMake: Fix build without qtshadertoolsJoerg Bornemann2022-11-252-2/+1
| | | | | | | | | | | | | | The find_package(... ShaderTools) call was moved to the top-level CMakeLists.txt in a previous commit. Also, the package was made optional. The qtshadertools dependency in dependencies.yaml is also marked as optional. Make the qt3d-rhi-renderer feature dependent on the availability of the Qt::ShaderTools target. Change-Id: I4849428d1ff4405b7547d56251c3c81bfa2e6a5b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: fix build: qtshadertools may be requiredThiago Macieira2022-11-241-1/+1
| | | | | | | | | | | | | | | CMake Error at src/plugins/renderers/rhi/rhi.cmake:7 (target_link_libraries) Error evaluating generator expression: $<TARGET_PROPERTY:Qt6::ShaderTools,_qt_module_has_private_headers> Target "Qt6::ShaderTools" not found. Call Stack (most recent call first): tests/auto/render/rhi/rhi_renderviews/CMakeLists.txt:21 (qt3d_setup_rhi_renderer_target) Pick-to: 6.4 Change-Id: I76216ced393445a4ae2dfffd172a502aec56333b Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* OpenGL SubmissionContext: reset defaultFBO every time we begin drawingPaul Lemire2022-11-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | We wrongly assumed that the default FBO id would remain constant over time once the submission context had been initialized. However it appears that when using Qt3D with a QQuickWidget/QQuickRender control with offscreen surfaces, the default FBO might change over time as the offscreen surface might get recreated. To compute the proper render target size, we rely on comparing the default FBO id against the active FBO id being used at various times in the rendering process. If the default FBO has changed since initialization (due to an offscreen windows recreation on a resize for example), we run the risk of having invalid comparisons between the default FBO and current active FBO. This results in possible erronous render size values when going through SubmissionContext::renderTargetSize. This can lead to occasional flickering or the scene not rendering (getting a reported size of 1x1) when resizing a QQuickWidget holding a Scene3D. Pick-to: 6.2 6.4 5.15 Change-Id: I18371e8e19213c472bdb64a6f339ee0941e5cb3d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unpin previously used image units during render command parameter setupOle Wegen2022-11-171-0/+4
| | | | | | | | | | Image units are not unpinned after executing a render/compute command and before executing the next one. This can lead to failure during binding of textures to image units if the number of required image units of subsequent commands exceeds the overall number of image units. Therefore, the image units are now unpinned during parameter setup of each command. Pick-to: 6.4 5.15 Change-Id: I9ae7be0bf8c2efe33aca836ef9e81db7c8f5b654 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-171-4/+4
| | | | | Change-Id: I43d16b122b6af313de629446919f46c74c721cad Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-161-4/+4
| | | | | Change-Id: I36c115a51f8010e4648a9d29fcc8417617787567 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-141-4/+4
| | | | | Change-Id: I56eec5129c97c6ddd63f9af324a6d00a4cc063a0 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Monthly re-run of clang-tidy qt-* checks (11/2022)Marc Mutz2022-11-111-2/+2
| | | | | Change-Id: Ie08a1878d6852367c7bbffe3d11d22535d0c895c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-091-4/+4
| | | | | Change-Id: I34f2ee3bf29655fe7a2da93a2118a38db9b5cfbd Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-081-4/+4
| | | | | Change-Id: Id8505d7f28be587c3360ab05e15246bb5ec2bf51 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-031-4/+4
| | | | | Change-Id: Ibb5529f1071f478dab8fe18b476b7aad979d4901 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* ShaderParameterPack: check we only store a single UBO/SSBO per BlockBindingPaul Lemire2022-11-022-2/+80
| | | | | | | | | | | | | Since we cache ShaderParameterPacks over multiple frames, we need to ensure that we check that when setting a UBO/SSBO we don't already have an entry matching the block index. If that's the case we should simply replace the entry rather than append a new entry. Failing to do so results in appending a growing number of UBO entries for the same block. Pick-to: 6.4 6.2 5.15 Change-Id: Ie7535a80b9426ce2fd5ab6ebe16ea71bd7447750 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* OpenGL graphics helpers fixesPaul Lemire2022-11-026-9/+18
| | | | | | | | | | | | - Adjust warning message to match GL version they are used against - Correctly call glDrawElementsInstancedBaseVertexBaseInstance on GL 4 - Overload glDrawArraysInstancedBaseInstance to call glDrawArraysInstanced on ES 3 Pick-to: 6.4 6.2 5.15 Change-Id: I54e054cc636327e424e4732362dfa2d79562d958 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-11-011-4/+4
| | | | | Change-Id: Icf6f11d9a2930d20e0c044784b299a715e24c2f5 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Enable syncqt cppAlexey Edelev2022-10-281-0/+2
| | | | | | Change-Id: I97037b97b91c85d4aba3cf7c02b08396a88f7047 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix unused parameter warnings on WindowsJohannes Kauffmann2022-10-282-0/+8
| | | | | | Pick-to: 6.2 6.4 Change-Id: Ib1713bbbabc75a30a3130e9db715479a35d0f3fc Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Quick3DNodeInstantiator: fix crash when using asyncPaul Lemire2022-10-273-9/+91
| | | | | | | | | | | | | | | | Something in the asynchronous creation of elements in QtQuick has been changed leading to elements of the instantiator being created out of order. QQmlInstantiator and friends had been updated at the time when the QtQuick changes were made but Quick3DNodeInstantiator was left out. This patch incorporate changes that have been made into QQmlInstantiator to correct out of order node creation. Task-number: QTBUG-56368 Pick-to: 6.4 6.2 5.15 Change-Id: I2aa7499e6dc08be329cd42ded7377acd4088e0c7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update dependencies on 'dev' in qt/qt3dQt Submodule Update Bot2022-10-261-4/+4
| | | | | Change-Id: Ie4e459b24a8d31026d1bd5e9bb8f699b0e5000b9 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* RHI: Set default render target for RenderCaptureYAMAMOTO Atsushi2022-10-261-1/+1
| | | | | | | | | | Current QRenderCapture captures the entire window, but it should capture the 3D scene. Pick-to: 6.4 Task-number: QTBUG-106865 Change-Id: Icc92ad31f5ae099858477d84735957d1a0113538 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-2075-186/+186
| | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I1b3c7c4058726c55199fd8ba74b6d6890ad8dd93 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-20112-708/+708
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3b040fa72968753048fd669c073ae80c3ba1bdad Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Port to new Q_UNREACHABLE_RETURN()Marc Mutz2022-10-2019-52/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. Change-Id: I3855b2dc8523db1ea860f72ad9818738162495c6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>