gen_ccls_file.sh 726 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. ##############################################################################
  3. # THIS MUST BE CALLED FROM THE ROOT DIRECTORY. IT IS USED BY THE MAKEFILE SO #
  4. # IN THEORY, YOU SHOULD NEVER CALL THIS. #
  5. ##############################################################################
  6. set -e
  7. CCLS_FILE=".ccls"
  8. # Get all #define *_PRIVATE from our source. We need to list them in our .ccls
  9. # file and enable them otherwise ccls will not find their definition thinking
  10. # that they are dead code.
  11. PRIVATE_DEFS=$(grep -r --include \*.h "_PRIVATE" | grep "#ifdef" | cut -d' ' -f2 | sort | uniq)
  12. echo "clang" > "$CCLS_FILE"
  13. for p in $PRIVATE_DEFS; do
  14. echo "-D$p" >> "$CCLS_FILE"
  15. done