1 #!/bin/sh 2 3 # This file is part of CMake-codecov. 4 # 5 # Copyright (c) 6 # 2015-2017 RWTH Aachen University, Federal Republic of Germany 7 # 8 # See the LICENSE file in the package base directory for details 9 # 10 # Written by Alexander Haase, alexander.haase (at] rwth-aachen.de 11 # 12 13 if [ -z "$LLVM_COV_BIN" ] 14 then 15 echo "LLVM_COV_BIN not set!" >& 2 16 exit 1 17 fi 18 19 20 # Get LLVM version to find out. 21 LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ 22 | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") 23 24 if [ "$1" = "-v" ] 25 then 26 echo "llvm-cov-wrapper $LLVM_VERSION" 27 exit 0 28 fi 29 30 31 if [ -n "$LLVM_VERSION" ] 32 then 33 MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1) 34 MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2) 35 36 if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ] 37 then 38 if [ -f "$1" ] 39 then 40 filename=$(basename "$1") 41 extension="${filename##*.}" 42 43 case "$extension" in 44 "gcno") exec $LLVM_COV_BIN --gcno="$1" ;; 45 "gcda") exec $LLVM_COV_BIN --gcda="$1" ;; 46 esac 47 fi 48 fi 49 50 if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ] 51 then 52 exec $LLVM_COV_BIN $@ 53 fi 54 fi 55 56 exec $LLVM_COV_BIN gcov $@ 57