summaryrefslogtreecommitdiff
path: root/scripts/maint/generate_callgraph.sh
blob: 97330cc949093a66cea754862c49a1a06cada31b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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
  clang $CFLAGS  -S -emit-llvm -fno-inline -o - $fn  | \
    opt -analyze -print-callgraph 2> "callgraph/${fn}allgraph"
done