Merge branch 'maint-0.4.8'
[tor.git] / scripts / maint / gen_ccls_file.sh
blob04e31d22a82d22e1314681ee077ba371d77e41ac
1 #!/bin/sh
3 ##############################################################################
4 # THIS MUST BE CALLED FROM THE ROOT DIRECTORY. IT IS USED BY THE MAKEFILE SO #
5 # IN THEORY, YOU SHOULD NEVER CALL THIS. #
6 ##############################################################################
8 set -e
10 CCLS_FILE=".ccls"
12 # Get all #define *_PRIVATE from our source. We need to list them in our .ccls
13 # file and enable them otherwise ccls will not find their definition thinking
14 # that they are dead code.
15 PRIVATE_DEFS=$(grep -r --include \*.h "_PRIVATE" | grep "#ifdef" | cut -d' ' -f2 | sort | uniq)
17 echo "clang" > "$CCLS_FILE"
19 # Add these include so the ccls server can properly check new files that are
20 # not in the compile_commands.json yet
22 echo "-I."
23 echo "-I./src"
24 echo "-I./src/ext"
25 echo "-I./src/ext/trunnel"
26 } >> "$CCLS_FILE"
28 # Add all defines (-D).
29 for p in $PRIVATE_DEFS; do
30 echo "-D$p" >> "$CCLS_FILE"
31 done