junrushao commented on code in PR #230:
URL: https://github.com/apache/tvm-ffi/pull/230#discussion_r2502103473


##########
include/tvm/ffi/function.h:
##########
@@ -878,6 +880,56 @@ inline int32_t TypeKeyToIndex(std::string_view type_key) {
         reinterpret_cast<::tvm::ffi::Any*>(result));                           
        \
     TVM_FFI_SAFE_CALL_END();                                                   
        \
   }                                                                            
        \
+  TVM_FFI_DLL_EXPORT const char* __tvm_ffi__metadata_##ExportName() {          
        \
+    using FuncInfo = ::tvm::ffi::details::FunctionInfo<decltype(Function)>;    
        \
+    static std::string metadata_json = []() {                                  
        \
+      std::ostringstream oss;                                                  
        \
+      oss << R"({"type_schema":)"                                              
        \
+          << 
::tvm::ffi::EscapeString(::tvm::ffi::String(FuncInfo::TypeSchema()));     \
+      oss << R"(,"arg_const":[)";                                              
        \
+      ::tvm::ffi::details::ArgConstHelper<typename 
FuncInfo::ArgType>::Generate(oss);  \
+      oss << "]}";                                                             
        \
+      return oss.str();                                                        
        \
+    }();                                                                       
        \
+    return metadata_json.c_str();                                              
        \

Review Comment:
   Note that string escaping here is not constexpr, which means it’s not 
possible to make it constexpr.



-- 
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]

Reply via email to