Index: mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
index 5cb1dc8b68d1293e50013ac5e27ef1dafea74bb9..99731fb5e0a3bb9d3a959c27283416a950920c71 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
@@ -41,6 +41,11 @@ if (!{{field.kind|cpp_wrapper_type}}::Data_::Validate( |
} |
{%- endmacro -%} |
+{%- macro validate_enum(field_expr, field) -%} |
+if (!mojo::internal::ValidateEnum(*{{field_expr}})) |
+ return false; |
+{%- endmacro -%} |
+ |
{%- macro validate_union_field(field, union) %} |
{%- set field_expr = "(reinterpret_cast<const " |
~ field.kind|cpp_union_field_type |
@@ -61,5 +66,9 @@ if (!{{field.kind|cpp_wrapper_type}}::Data_::Validate( |
{%- if field.kind|is_any_handle_kind -%} |
{{ validate_handle(field_expr, field, union.name) }} |
{%- endif %} |
+ |
+{%- if field.kind|is_enum_kind -%} |
+{{ validate_enum(field_expr, field) }} |
+{%- endif %} |
return true; |
{%- endmacro %} |