yaoyaoding commented on code in PR #230:
URL: https://github.com/apache/tvm-ffi/pull/230#discussion_r2539748284
##########
python/tvm_ffi/cpp/extension.py:
##########
@@ -366,8 +371,14 @@ def _decorate_with_tvm_ffi(source: str, functions:
Mapping[str, str]) -> str:
]
for func_name, func_doc in functions.items():
- sources.append(f"TVM_FFI_DLL_EXPORT_TYPED_FUNC({func_name},
{func_name});")
- _ = func_doc # todo: add support to embed function docstring to the
tvm ffi functions.
+ if func_doc:
+ # Escape the docstring for C++ string literal
+ escaped_doc = func_doc.replace("\\", "\\\\").replace('"',
'\\"').replace("\n", "\\n")
Review Comment:
If we allow `None` here, it seems allow the user to only provide docstring
for some functions while leave docs for other function be None. I feel it's not
very necessary here, the user can use empty string as a placeholder for the
functions do not need a docstring.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]