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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl

Issue 2637393002: Make mojom-generated C++ string constants really constant. (Closed)
Patch Set: Created 3 years, 11 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
Index: mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
index a90d8ac91572ca82f019e909df44e5a478747079..7f6497475a62f318d71dc3a9e486148af8bd628c 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
@@ -13,9 +13,9 @@ class {{export_attribute}} {{interface.name}}
: public {{interface.name}}InterfaceBase {
public:
static const char Name_[];
- static const uint32_t Version_ = {{interface.version}};
- static const bool PassesAssociatedKinds_ = {% if interface|passes_associated_kinds %}true{% else %}false{% endif %};
- static const bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{% else %}false{% endif %};
+ static constexpr uint32_t Version_ = {{interface.version}};
+ static constexpr bool PassesAssociatedKinds_ = {% if interface|passes_associated_kinds %}true{% else %}false{% endif %};
+ static constexpr bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{% else %}false{% endif %};
using Proxy_ = {{interface.name}}Proxy;
@@ -43,11 +43,7 @@ class {{export_attribute}} {{interface.name}}
{#--- Constants #}
{%- for constant in interface.constants %}
-{%- if constant.kind|is_integral_kind %}
- static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_value}};
-{%- else %}
- static const {{constant.kind|cpp_pod_type}} {{constant.name}};
-{%- endif %}
+ static {{constant|format_constant_declaration(nested=True)}};
{%- endfor %}
{#--- Methods #}

Powered by Google App Engine
This is Rietveld 408576698