Skip to content

Commit

Permalink
Use field identifiers when code gen struct items (#12222)
Browse files Browse the repository at this point in the history
* Use field identifiers when code gen struct items

Field identifiers were not being used. Instead, the order of field
identifiers was used, with ordinal (0 to N-1) indexes.

This is likely true of other code generated elements, but this PR only
fixes it for struct items.

This PR requires PR #326 in the third_party/zap/repo to function,
as that PR actually includes the field identifier in the query
results.

Tested by running Matter cert tests, and also by inspecting the
generated code for correctness.

* Update zap submodule to latest

* Update a few generated zap files

Re-ran cert tests.

* Restyling

Why are we styling generated code?!

* Revert zap repo update

* Update zap to latest zap version

* Regen zap with the new zap version

Co-authored-by: Andrei Litvin <andy314@gmail.com>
  • Loading branch information
2 people authored and pull[bot] committed May 11, 2022
1 parent 5da3c52 commit 1f46a32
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 185 deletions.
2 changes: 1 addition & 1 deletion src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace Structs {
namespace {{asUpperCamelCase name}} {
enum class Fields {
{{#zcl_struct_items}}
k{{asUpperCamelCase label}} = {{index}},
k{{asUpperCamelCase label}} = {{fieldIdentifier}},
{{/zcl_struct_items}}
};

Expand Down
2 changes: 1 addition & 1 deletion third_party/zap/repo
Loading

0 comments on commit 1f46a32

Please sign in to comment.