tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

gen_ccls_file.sh (978B)


      1 #!/bin/sh
      2 
      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 ##############################################################################
      7 
      8 set -e
      9 
     10 CCLS_FILE=".ccls"
     11 
     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)
     16 
     17 echo "clang" > "$CCLS_FILE"
     18 
     19 # Add these include so the ccls server can properly check new files that are
     20 # not in the compile_commands.json yet
     21 {
     22    echo "-I."
     23    echo "-I./src"
     24    echo "-I./src/ext"
     25    echo "-I./src/ext/trunnel"
     26 } >> "$CCLS_FILE"
     27 
     28 # Add all defines (-D).
     29 for p in $PRIVATE_DEFS; do
     30    echo "-D$p" >> "$CCLS_FILE"
     31 done