about summary refs log tree commit diff homepage
path: root/scripts/build/p-clang-linux.inc
blob: f3dfbb6ea3d757d3b0fe85cac13ebb8589906ff6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
setup_artifact_variables_clang() {
  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
  local version=""
  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}"
  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"

  # Only set LLVM_CONFIG if not set yet
  if [[ -z "${LLVM_CONFIG-}" ]]; then
    LLVM_CONFIG=$(which "llvm-config${version}")
  fi


  local bin_path=""
  bin_path="$(dirname "$(readlink -f "$(which "clang${version}")")")"

  BITCODE_CC="${bin_path}/clang"
  BITCODE_CXX="${bin_path}/clang++"

  #[[ -z ${SANITIZER_C_COMPILER+x} ]] && 
  SANITIZER_C_COMPILER="${BITCODE_CC}"
  #[[ -z ${SANITIZER_CXX_COMPILER+x} ]] && 
  SANITIZER_CXX_COMPILER="${BITCODE_CXX}"
}

# Check if the binary artifact is installed
is_installed_clang() {
  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
  local version=""
  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"

  # Check if clang with the right version exists
  which "clang-${version}"
}