[Libclc-dev] [PATCH v2 4/6] Add script to check for unresolved function calls

Aaron Watry via Libclc-dev libclc-dev at lists.llvm.org
Fri Sep 29 11:41:46 PDT 2017


On Fri, Sep 29, 2017 at 1:10 AM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> v2: add shell shebang
>     improve error checks and reporting
>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>  check_external_calls.sh | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100755 check_external_calls.sh
>
> diff --git a/check_external_calls.sh b/check_external_calls.sh
> new file mode 100755
> index 0000000..5605552
> --- /dev/null
> +++ b/check_external_calls.sh
> @@ -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: Dissassmbler '$DIS' is not executable"

Type-o: s/Dissassmbler/Disassembler/

With that, Reviewed-by: Aaron Watry <awatry at gmail.com>

> +       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
> --
> 2.13.5
>


More information about the Libclc-dev mailing list