Moc: prevent potential unnecessary detach

Change Generator::generateSignal() to take by const FunctionDef*, so
that it can be called with the return of QList::at().

Change-Id: I5ffb0726a5ded6561e0000a2bea1973ada675152
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-05-21 22:52:47 +03:00
parent 17df4bf528
commit 475d5266e4
2 changed files with 3 additions and 3 deletions

View File

@ -627,7 +627,7 @@ void Generator::generateCode()
// Generate internal signal functions // Generate internal signal functions
// //
for (int signalindex = 0; signalindex < int(cdef->signalList.size()); ++signalindex) for (int signalindex = 0; signalindex < int(cdef->signalList.size()); ++signalindex)
generateSignal(&cdef->signalList[signalindex], signalindex); generateSignal(&cdef->signalList.at(signalindex), signalindex);
// //
// Generate plugin meta data // Generate plugin meta data
@ -1408,7 +1408,7 @@ void Generator::generateStaticMetacall()
fprintf(out, "}\n"); fprintf(out, "}\n");
} }
void Generator::generateSignal(FunctionDef *def,int index) void Generator::generateSignal(const FunctionDef *def, int index)
{ {
if (def->wasCloned || def->isAbstract) if (def->wasCloned || def->isAbstract)
return; return;

View File

@ -40,7 +40,7 @@ private:
void generateProperties(); void generateProperties();
void generateMetacall(); void generateMetacall();
void generateStaticMetacall(); void generateStaticMetacall();
void generateSignal(FunctionDef *def, int index); void generateSignal(const FunctionDef *def, int index);
void generatePluginMetaData(); void generatePluginMetaData();
QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper(); QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper();
QMap<int, QMultiMap<QByteArray, int>> QMap<int, QMultiMap<QByteArray, int>>