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@rwth-aachen.de 11# 12 13if [ -z "$LLVM_COV_BIN" ] 14then 15 echo "LLVM_COV_BIN not set!" >& 2 16 exit 1 17fi 18 19 20# Get LLVM version to find out. 21LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ 22 | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") 23 24if [ "$1" = "-v" ] 25then 26 echo "llvm-cov-wrapper $LLVM_VERSION" 27 exit 0 28fi 29 30 31if [ -n "$LLVM_VERSION" ] 32then 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 54fi 55 56exec $LLVM_COV_BIN gcov $@ 57