Repository: dotnet/runtime
File: src/coreclr/inc/corinfo.h (C/C++)

Code before:

    // Signature information about the call sig
    virtual void findSig (
            CORINFO_MODULE_HANDLE       module,     /* IN */
            unsigned                    sigTOK,     /* IN */
            CORINFO_CONTEXT_HANDLE      context,    /* IN */
            CORINFO_SIG_INFO           *sig         /* OUT */
            ) = 0;

    // for Varargs, the signature at the call site may differ from
    // the signature at the definition.  Thus we need a way of
    // fetching the call site information
    virtual void findCallSiteSig (
            CORINFO_MODULE_HANDLE       module,     /* IN */
            unsigned                    methTOK,    /* IN */
            CORINFO_CONTEXT_HANDLE      context,    /* IN */
            CORINFO_SIG_INFO           *sig         /* OUT */
            ) = 0;

    virtual CORINFO_CLASS_HANDLE getTokenTypeAsHandle (
            CORINFO_RESOLVED_TOKEN *    pResolvedToken /* IN  */) = 0;

    // Returns (sub)string length and content (can be null for dynamic context)
    // for given metaTOK and module, length `-1` means input is incorrect.
    //
    // Return value: The actual length of the string literal. Note that this may be larger
    // than bufferSize, in which case only bufferSize characters are copied to buffer.
    // The caller should use min(returnValue, bufferSize) when working with the buffer.
    virtual int getStringLiteral (
            CORINFO_MODULE_HANDLE       module,     /* IN  */
            unsigned                    metaTOK,    /* IN  */
            char16_t*                   buffer,     /* OUT */
            int                         bufferSize, /* IN  */
            int                         startIndex = 0 /* IN  */
            ) = 0;


    //------------------------------------------------------------------------------
    // printObjectDescription: Prints a (possibly truncated) textual UTF8 representation of the given
    //    object to a preallocated buffer. It's intended to be used only for debug/diagnostic
    //    purposes such as JitDisasm. The buffer is null-terminated (even if truncated).
    //
    // Arguments:
    //    handle     -          Direct object handle
    //    buffer     -          Pointer to buffer. Can be nullptr.
    //    bufferSize -          Buffer size (in bytes).
    //    pRequiredBufferSize - Full length of the textual UTF8 representation, in bytes.
    //                          Includes the null terminator, so the value is always at least 1,
    //                          where 1 indicates an empty string.
    //                          Can be used to call this API again with a bigger buffer to get the full
    //                          string.

Review comment (suggestion):
```suggestion
    // Return value: The actual length of the (sub)string. Note that this may be larger
```

Code after:

    // Signature information about the call sig
    virtual void findSig (
            CORINFO_MODULE_HANDLE       module,     /* IN */
            unsigned                    sigTOK,     /* IN */
            CORINFO_CONTEXT_HANDLE      context,    /* IN */
            CORINFO_SIG_INFO           *sig         /* OUT */
            ) = 0;

    // for Varargs, the signature at the call site may differ from
    // the signature at the definition.  Thus we need a way of
    // fetching the call site information
    virtual void findCallSiteSig (
            CORINFO_MODULE_HANDLE       module,     /* IN */
            unsigned                    methTOK,    /* IN */
            CORINFO_CONTEXT_HANDLE      context,    /* IN */
            CORINFO_SIG_INFO           *sig         /* OUT */
            ) = 0;

    virtual CORINFO_CLASS_HANDLE getTokenTypeAsHandle (
            CORINFO_RESOLVED_TOKEN *    pResolvedToken /* IN  */) = 0;

    // Returns (sub)string length and content (can be null for dynamic context)
    // for given metaTOK and module, length `-1` means input is incorrect.
    //
    // Return value: The actual length of the (sub)string. Note that this may be larger
    // than bufferSize, in which case only bufferSize characters are copied to buffer.
    virtual int getStringLiteral (
            CORINFO_MODULE_HANDLE       module,     /* IN  */
            unsigned                    metaTOK,    /* IN  */
            char16_t*                   buffer,     /* OUT */
            int                         bufferSize, /* IN  */
            int                         startIndex = 0 /* IN  */
            ) = 0;


    //------------------------------------------------------------------------------
    // printObjectDescription: Prints a (possibly truncated) textual UTF8 representation of the given
    //    object to a preallocated buffer. It's intended to be used only for debug/diagnostic
    //    purposes such as JitDisasm. The buffer is null-terminated (even if truncated).
    //
    // Arguments:
    //    handle     -          Direct object handle
    //    buffer     -          Pointer to buffer. Can be nullptr.
    //    bufferSize -          Buffer size (in bytes).
    //    pRequiredBufferSize - Full length of the textual UTF8 representation, in bytes.
    //                          Includes the null terminator, so the value is always at least 1,
    //                          where 1 indicates an empty string.
    //                          Can be used to call this API again with a bigger buffer to get the full
    //                          string.
    //