Skip to content

Commit

Permalink
moc: Output "isConst" attribute for methods in JSON
Browse files Browse the repository at this point in the history
We need it to decide whether to generate write-back operations when
compiling method calls on QML value types to C++.

Task-number: QTBUG-127174
Change-Id: I63d3c2fbbbd463451cee57ddf33fa42d21335ac6
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
Ulf Hermann committed Nov 15, 2024
1 parent b0b278d commit 94cbd20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tools/moc/moc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,8 @@ QJsonObject FunctionDef::toJson(int index) const
if (!tag.isEmpty())
fdef["tag"_L1] = QString::fromUtf8(tag);
fdef["returnType"_L1] = QString::fromUtf8(normalizedType);
if (isConst)
fdef["isConst"_L1] = true;

QJsonArray args;
for (const ArgumentDef &arg: arguments)
Expand Down
20 changes: 20 additions & 0 deletions tests/auto/tools/moc/allmocs_baseline_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -369,12 +371,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -407,12 +411,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -445,12 +451,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -483,12 +491,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -521,12 +531,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -559,12 +571,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -597,12 +611,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -635,12 +651,14 @@
{
"access": "private",
"index": 2,
"isConst": true,
"name": "pureSlot2",
"returnType": "void"
},
{
"access": "private",
"index": 3,
"isConst": true,
"name": "pureSlot3",
"returnType": "void"
}
Expand Down Expand Up @@ -835,6 +853,7 @@
{
"access": "public",
"index": 5,
"isConst": true,
"name": "constConstRefReturn",
"returnType": "void"
}
Expand Down Expand Up @@ -2149,6 +2168,7 @@
{
"access": "public",
"index": 0,
"isConst": true,
"name": "foo",
"returnType": "const char*"
}
Expand Down

0 comments on commit 94cbd20

Please sign in to comment.