Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2047)

Unified Diff: mojo/public/tools/bindings/generators/mojom_cpp_generator.py

Issue 2244363003: Mojo C++ bindings: disallow copy and assign for generated classes when necessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the actual fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/mojom_cpp_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index a9fa2398588904778dbf5f7e0478f9f817bb2034..77403dba39e042df1f70ddb579150817efb894e1 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -383,6 +383,12 @@ def ShouldInlineStruct(struct):
return False
return True
+def ContainsMoveOnlyMembers(struct):
+ for field in struct.fields:
+ if IsMoveOnlyKind(field.kind):
+ return True
+ return False
+
def ShouldInlineUnion(union):
return not any(
mojom.IsReferenceKind(field.kind) and not mojom.IsStringKind(field.kind)
@@ -436,6 +442,7 @@ class Generator(generator.Generator):
cpp_filters = {
"constant_value": ConstantValue,
+ "contains_move_only_members": ContainsMoveOnlyMembers,
"cpp_wrapper_param_type": GetCppWrapperParamType,
"cpp_data_view_type": GetCppDataViewType,
"cpp_field_type": GetCppFieldType,
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698