From 4473092c7e62d031f61163b1badd7ce6f07e6193 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:23:23 +0200 Subject: [PATCH 1/4] Update qt.cfg --- cfg/qt.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/qt.cfg b/cfg/qt.cfg index 9f6540a310c..2011c66f760 100644 --- a/cfg/qt.cfg +++ b/cfg/qt.cfg @@ -5078,7 +5078,7 @@ - + From c1e9f0adacb7e20c15ea944dd7e6c0bd42f346e0 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:25:43 +0200 Subject: [PATCH 2/4] Update qt.cpp --- test/cfg/qt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/cfg/qt.cpp b/test/cfg/qt.cpp index 2c0e836f7f3..ce68cbf5e5f 100644 --- a/test/cfg/qt.cpp +++ b/test/cfg/qt.cpp @@ -323,6 +323,13 @@ QList::iterator QList3() return it; } +void QList4() // #13001 +{ + QList ql; + ql.append(QList>()); + if (ql.isEmpty()) {} +} + void QLinkedList1() { // cppcheck-suppress unreadVariable From 743dcef84fe8b262e87650b6d6e9b4bfea90f45f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:58:16 +0200 Subject: [PATCH 3/4] Update valueflow.cpp --- lib/valueflow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 72da844aa87..dffd3ba91ec 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -6574,6 +6574,10 @@ struct ContainerExpressionAnalyzer : ExpressionAnalyzer { n = -1; break; case Library::Container::Action::APPEND: { + if (!container->stdStringLike) { + val->setPossible(); // TODO: use appendee's size + break; + } std::vector args = getArguments(tok->astParent()->tokAt(2)); if (args.size() == 1) // TODO: handle overloads n = valueFlowGetStrLength(tok->astParent()->tokAt(3)); From 626b04276dcdb9fb5084d3d5bf980b1097bee394 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Aug 2024 19:06:35 +0200 Subject: [PATCH 4/4] Update qt.cpp --- test/cfg/qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cfg/qt.cpp b/test/cfg/qt.cpp index ce68cbf5e5f..7059a75d78b 100644 --- a/test/cfg/qt.cpp +++ b/test/cfg/qt.cpp @@ -326,7 +326,7 @@ QList::iterator QList3() void QList4() // #13001 { QList ql; - ql.append(QList>()); + ql.append(QList()); if (ql.isEmpty()) {} }