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

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

Issue 2721953003: Makes mojo generator generate export for constants (Closed)
Patch Set: Created 3 years, 10 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/module.h.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 c75013badf88a19cab5a678a1b77174e20c877fc..35b4a640a5fda743aee27624aded0d51526b336e 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -216,11 +216,12 @@ def GetNativeTypeName(typemapped_kind):
def GetCppPodType(kind):
return _kind_to_cpp_type[kind]
-def FormatConstantDeclaration(constant, nested=False):
+def FormatConstantDeclaration(constant, nested=False, export_attribute=None):
yzshen1 2017/02/28 23:13:09 Instead of having an export_attribute input, how a
sky 2017/02/28 23:45:04 Done.
if mojom.IsStringKind(constant.kind):
if nested:
return "const char %s[]" % constant.name
- return "extern const char %s[]" % constant.name
+ return "%sextern const char %s[]" % \
+ ((export_attribute + " ") if export_attribute else "", constant.name)
return "constexpr %s %s = %s" % (GetCppPodType(constant.kind), constant.name,
ConstantValue(constant))
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698