summaryrefslogtreecommitdiff
path: root/scripts/maint/generate_callgraph.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/maint/generate_callgraph.sh')
-rwxr-xr-xscripts/maint/generate_callgraph.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/maint/generate_callgraph.sh b/scripts/maint/generate_callgraph.sh
new file mode 100755
index 0000000000..c6b33c0aea
--- /dev/null
+++ b/scripts/maint/generate_callgraph.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+C_FILES=`echo src/common/*.c src/or/*.c src/tools/*.c`
+CFLAGS="-Isrc/ext/trunnel -Isrc/trunnel -I. -Isrc/ext -Isrc/common -DLOCALSTATEDIR=\"\" -DSHARE_DATADIR=\"\" -Dinline="
+
+mkdir -p callgraph/src/common
+mkdir -p callgraph/src/or
+mkdir -p callgraph/src/tools
+
+for fn in $C_FILES; do
+ echo $fn
+ clang $CFLAGS -S -emit-llvm -fno-inline -o - $fn | \
+ opt -analyze -print-callgraph >/dev/null 2> "callgraph/${fn}allgraph"
+done