Doxyfile で、次のように設定します。
GENERATE_XML = YES
その後、XML ファイルでコール グラフを見つけることができます。callergraph でマークされた関数ごとに、<referencedby>
使用できる要素が出力に表示されます。これは、私の C ファイルの 1 つからのサンプルです。
<memberdef kind="function" id="spfs_8c_1a3"
prot="public" static="yes" const="no" explicit="no"
inline="no" virt="non-virtual">
<type>svn_error_t *</type>
<definition>svn_error_t * init_apr</definition>
<argsstring>(apr_pool_t **ppool, int *argc, char const *const **argv)</argsstring>
<name>init_apr</name>
<!-- param and description elements clipped for brevity ... -->
<location file="src/spfs.c" line="26" bodystart="101" bodyend="120"/>
<referencedby refid="spfs_8c_1a13" compoundref="spfs_8c"
startline="45" endline="94">main</referencedby>
</memberdef>
したがって、すべての memberdef/referencedby ペアに対して、呼び出し元と呼び出し先の関係があり、XSLT を介して取得できます。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//memberdef[@kind eq 'function']"/>
</xsl:template>
<xsl:template match="memberdef">
<xsl:variable name="function-name"
select="concat(definition, argsstring)"/>
<xsl:for-each select="referencedby">
<xsl:value-of select="concat(./text(), ' calls ', $function-name, '
')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
次のように、呼び出し元と呼び出し先ごとに行が表示されます。
main calls svn_error_t * init_apr(apr_pool_t **ppool, int *argc, char const *const **argv)
その XSLT を微調整してから、その有向グラフを最小のエッジで分割する方法で分割する必要があります。うわー、NP完全問題!幸いなことに、この件に関する多くの論文があり、いくつかはここにあります: http://www.sandia.gov/~bahendr/partitioning.html