[libclc] r314546 - Add script to check for unresolved function calls

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 29 12:06:48 PDT 2017


Author: jvesely
Date: Fri Sep 29 12:06:48 2017
New Revision: 314546

URL: http://llvm.org/viewvc/llvm-project?rev=314546&view=rev
Log:
Add script to check for unresolved function calls

v2: add shell shebang
    improve error checks and reporting
v3: fix typo

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Aaron Watry <awatry at gmail.com>

Added:
    libclc/trunk/check_external_calls.sh   (with props)

Added: libclc/trunk/check_external_calls.sh
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/check_external_calls.sh?rev=314546&view=auto
==============================================================================
--- libclc/trunk/check_external_calls.sh (added)
+++ libclc/trunk/check_external_calls.sh Fri Sep 29 12:06:48 2017
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+FILE=$1
+if [ ! -f $FILE ]; then
+	echo "ERROR: Not a file: $FILE"
+	exit 3
+fi
+ret=0
+if [ "x$LLVM_CONFIG" = "x" ]; then
+	LLVM_CONFIG=llvm-config
+	echo 'WARNING: $LLVM_CONFIG not set, falling back to $PATH llvm-config'
+	ret=2
+fi
+
+
+BIN_DIR=$($LLVM_CONFIG --bindir)
+DIS="$BIN_DIR/llvm-dis"
+if [ ! -x $DIS ]; then
+	echo "ERROR: Disassembler '$DIS' is not executable"
+	exit 3
+fi
+
+TMP_FILE=$(mktemp)
+
+# Check for calls. Calls to llvm intrinsics are OK
+$DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE"
+
+if [ $(wc -l < "$TMP_FILE") -ne "0" ]; then
+	echo "ERROR: unresolved calls detected"
+	cat $TMP_FILE
+	ret=1
+else
+	echo "File $FILE is OK"
+fi
+exit $ret

Propchange: libclc/trunk/check_external_calls.sh
------------------------------------------------------------------------------
    svn:executable = *




More information about the cfe-commits mailing list