[clang-tidy] Use StringRef::contains (NFC)
[llvm-project.git] / libclc / check_external_calls.sh
blob4de31a220d070f53f1d67b47a169b5055453e380
1 #!/bin/sh
3 FILE=$1
4 BIN_DIR=$2
5 if [ ! -f $FILE ]; then
6 echo "ERROR: Not a file: $FILE"
7 exit 3
8 fi
9 ret=0
11 DIS="$BIN_DIR/llvm-dis"
12 if [ ! -x $DIS ]; then
13 echo "ERROR: Disassembler '$DIS' is not executable"
14 exit 3
17 TMP_FILE=$(mktemp)
19 # Check for calls. Calls to llvm intrinsics are OK
20 $DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE"
21 COUNT=$(wc -l < "$TMP_FILE")
23 if [ "$COUNT" -ne "0" ]; then
24 echo "ERROR: $COUNT unresolved calls detected in $FILE"
25 cat $TMP_FILE
26 ret=1
27 else
28 echo "File $FILE is OK"
30 exit $ret