1#!/bin/bash -ex
2
3# Usage:
4#
5#     ./update-libfuzzer $commit_hash
6#
7# Where `$commit_hash` is a commit hash from
8# https://github.com/llvm-mirror/llvm-project
9
10set -ex
11
12cd "$(dirname $0)"
13project_dir="$(pwd)"
14
15tmp_dir="$(mktemp -d)"
16
17git clone https://github.com/llvm/llvm-project.git "$tmp_dir"
18cd "$tmp_dir"
19git checkout "$1"
20rm -rf "$project_dir/libfuzzer/"
21mv "$tmp_dir/compiler-rt/lib/fuzzer/" "$project_dir/libfuzzer/"
22