yaoyaoding commented on code in PR #230:
URL: https://github.com/apache/tvm-ffi/pull/230#discussion_r2539767012
##########
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")
+ sources.append(
Review Comment:
Except the escaping as @tqchen mentioned, the current implementation looks
good to me. I feel we can keep the implementation as it is, and fix if there is
any issue.
--
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]