Commit 1206d950 authored by Caleb Raitto's avatar Caleb Raitto Committed by Commit Bot

[Cronet] Add support for constants in cronet idl.

This adds support needed by crrev.com/c/1374158.

Bug: 879208
Change-Id: I80894a166cf4233087b81a455cfc22a106f724e6
Reviewed-on: https://chromium-review.googlesource.com/c/1382694Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
Reviewed-by: default avatarMisha Efimov <mef@chromium.org>
Commit-Queue: Caleb Raitto <caraitto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619429}
parent e3d56bb3
...@@ -62,6 +62,11 @@ typedef enum {{enum_name}} { ...@@ -62,6 +62,11 @@ typedef enum {{enum_name}} {
{% endfor %} {% endfor %}
// Declare constants
{%- for constant in module.constants %}
{{constant|format_constant_declaration}};
{%- endfor %}
{#--- Interface Stubs -#} {#--- Interface Stubs -#}
{% for interface in interfaces %} {% for interface in interfaces %}
{%- set interface_name = interface|get_name_for_kind %} {%- set interface_name = interface|get_name_for_kind %}
......
...@@ -537,8 +537,8 @@ class Generator(generator.Generator): ...@@ -537,8 +537,8 @@ class Generator(generator.Generator):
return "%sextern const char %s[]" % \ return "%sextern const char %s[]" % \
((self.export_attribute + " ") if self.export_attribute else "", ((self.export_attribute + " ") if self.export_attribute else "",
constant.name) constant.name)
return "constexpr %s %s = %s" % ( return "const %s %s_%s = %s" % (
GetCppPodType(constant.kind), constant.name, GetCppPodType(constant.kind), self.module.namespace, constant.name,
self._ConstantValue(constant)) self._ConstantValue(constant))
def _GetCppWrapperType(self, kind, add_same_module_namespaces=False): def _GetCppWrapperType(self, kind, add_same_module_namespaces=False):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment