Skip to content

Commit 1c02772

Browse files
Fix #13902 FP constParameterPointer with QHash::insert() (#7566)
1 parent 51f6d91 commit 1c02772

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

cfg/qt.cfg

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,7 @@
32933293
<returnValue type="bool"/>
32943294
<use-retval/>
32953295
<const/>
3296-
<arg nr="1" direction="in">
3296+
<arg nr="1">
32973297
<not-uninit/>
32983298
</arg>
32993299
</function>
@@ -3304,7 +3304,7 @@
33043304
<returnValue type="int"/>
33053305
<use-retval/>
33063306
<const/>
3307-
<arg nr="1" direction="in" default="">
3307+
<arg nr="1" default="">
33083308
<not-uninit/>
33093309
</arg>
33103310
</function>
@@ -3320,18 +3320,18 @@
33203320
<function name="QHash::find">
33213321
<noreturn>false</noreturn>
33223322
<use-retval/>
3323-
<arg nr="1" direction="in">
3323+
<arg nr="1">
33243324
<not-uninit/>
33253325
</arg>
33263326
</function>
33273327
<!-- QHash::iterator QHash::insert(const Key &key, const T &value) -->
33283328
<function name="QHash::insert">
33293329
<noreturn>false</noreturn>
33303330
<returnValue type="QHash::iterator"/>
3331-
<arg nr="1" direction="in">
3331+
<arg nr="1">
33323332
<not-uninit/>
33333333
</arg>
3334-
<arg nr="2" direction="in">
3334+
<arg nr="2">
33353335
<not-uninit/>
33363336
</arg>
33373337
</function>
@@ -3368,10 +3368,10 @@
33683368
<noreturn>false</noreturn>
33693369
<use-retval/>
33703370
<const/>
3371-
<arg nr="1" direction="in">
3371+
<arg nr="1">
33723372
<not-uninit/>
33733373
</arg>
3374-
<arg nr="2" direction="in" default="">
3374+
<arg nr="2" default="">
33753375
<not-uninit/>
33763376
</arg>
33773377
</function>
@@ -3381,7 +3381,7 @@
33813381
<noreturn>false</noreturn>
33823382
<use-retval/>
33833383
<const/>
3384-
<arg nr="1" direction="in" default="">
3384+
<arg nr="1" default="">
33853385
<not-uninit/>
33863386
</arg>
33873387
</function>
@@ -5259,7 +5259,7 @@
52595259
<function name="crend" yields="end-iterator"/>
52605260
</access>
52615261
</container>
5262-
<container id="qtMap" startPattern="QMap|QMultiMap &lt;" inherits="qtContainer">
5262+
<container id="qtMap" startPattern="QMap|QMultiMap|QHash &lt;" inherits="qtContainer">
52635263
<type templateParameter="1" associative="std-like"/>
52645264
<rangeItemRecordType>
52655265
<member name="first" templateParameter="0"/>

test/cfg/qt.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,27 @@ void constVariablePointer_QVector(QVector<int*>& qv, int* p)
799799
qv.push_back(p); // #12661
800800
}
801801

802+
void constParameterPointer_QHash_insert(QHash<int*, int*>& qh, int* k, int* v)
803+
{
804+
qh.insert(k, v); // #13902
805+
}
806+
807+
bool constParameterPointer_QHash_find(const QHash<int*, int*>& qh, int* k)
808+
{
809+
auto it = qh.find(k);
810+
return it != qh.end();
811+
}
812+
813+
bool constParameterPointer_QHash_contains(const QHash<int*, int*>& qh, int* k)
814+
{
815+
return qh.contains(k);
816+
}
817+
818+
int constParameterPointer_QHash_count(const QHash<int*, int*>& qh, int* k)
819+
{
820+
return qh.count(k);
821+
}
822+
802823
const QString& unassignedVariable_static_QString() // #12935
803824
{
804825
static QString qs;
@@ -825,4 +846,4 @@ namespace {
825846

826847
// cppcheck-suppress functionStatic
827848
void TestUnusedFunction::doStuff() {} // Should not warn here with unusedFunction
828-
}
849+
}

0 commit comments

Comments
 (0)