Index: mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl |
index dddb6abbecf3d041e01171dfbbd996049fa5b6d5..fd2f610fee6f157076ef7cf651a8a47bca270cc6 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl |
@@ -2,6 +2,12 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+{%- if variant -%} |
+{%- set variant_path = "%s-%s"|format(module.path, variant) -%} |
+{%- else -%} |
+{%- set variant_path = module.path -%} |
+{%- endif %} |
+ |
#if defined(__clang__) |
#pragma clang diagnostic push |
#pragma clang diagnostic ignored "-Wunused-private-field" |
@@ -12,7 +18,7 @@ |
#pragma warning(disable:4756) |
#endif |
-#include "{{module.path}}.h" |
+#include "{{variant_path}}.h" |
#include <math.h> |
@@ -34,6 +40,9 @@ |
{%- for namespace in namespaces_as_array %} |
namespace {{namespace}} { |
{%- endfor %} |
+{%- if variant %} |
+namespace {{variant}} { |
+{%- endif %} |
{#--- Constants #} |
{%- for constant in module.constants %} |
@@ -121,6 +130,9 @@ MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc |
{%- include "union_serialization_definition.tmpl" %} |
{%- endfor %} |
+{%- if variant %} |
+} // namespace {{variant}} |
+{%- endif %} |
{%- for namespace in namespaces_as_array|reverse %} |
} // namespace {{namespace}} |
{%- endfor %} |