Open aben20807 opened 5 years ago
https://stackoverflow.com/a/5373814
static void D() { } static void Y() { D(); } static void X() { Y(); } static void C() { D(); X(); } static void B() { C(); } static void S() { D(); } static void P() { S(); } static void O() { P(); } static void N() { O(); } static void M() { N(); } static void G() { M(); } static void A() { B(); G(); } int main() { A(); }
$ vim t.cpp $ clang++ -S -emit-llvm t.cpp -o - | opt -analyze -dot-callgraph $ cat callgraph.dot | c++filt | sed 's,>,\\>,g; s,-\\>,->,g; s,<,\\<,g' | awk '/external node/{id=$1} $1 != id' | dot -Tpng -ocallgraph.png $ eog callgraph.png
https://stackoverflow.com/a/15804010 https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html
gcc test.c -fdump-tree-all-graph
https://stackoverflow.com/a/5373814