Skip to content

Commit

Permalink
Use field identifiers when code gen struct items
Browse files Browse the repository at this point in the history
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 project-chip#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.
  • Loading branch information
mlepage-google committed Nov 24, 2021
1 parent 53721c0 commit 175f2d3
Showing 1 changed file with 1 addition and 1 deletion.
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

0 comments on commit 175f2d3

Please sign in to comment.