dump_printf: add "%C" for dumping cgraph_node *
[official-gcc.git] / libsanitizer / merge.sh
blobfa340bedbac89871f9bb24e49218d7d8cf9d8da7
1 #!/bin/bash
3 # FIXME: do we need a license (or whatever else) header here?
5 # This script merges libsanitizer sources from upstream.
7 VCS=${1:-svn}
9 get_upstream() {
10 rm -rf upstream
11 #cp -rf orig upstream
12 svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk upstream
15 get_current_rev() {
16 cd upstream
17 svn info | grep Revision | grep -o '[0-9]*'
20 list_files() {
21 (cd $1; ls *.{cc,h,inc,S} 2> /dev/null)
25 change_comment_headers() {
26 for f in $(list_files $1); do
27 sed -n 3p $1/$f | grep -q 'The LLVM Compiler Infrastructure' || continue
28 changed=$(awk 'NR != 2 && NR != 3' < $1/$f)
29 echo "$changed" > $1/$f
30 done
33 # ARGUMENTS: upstream_path local_path
34 # This function merges changes from the directory upstream_path to
35 # the directory local_path.
36 merge() {
37 upstream_path=upstream/$1
38 local_path=$2
39 change_comment_headers $upstream_path
40 echo MERGE: $upstream_path
41 all=$( (list_files $upstream_path; list_files $local_path) | sort | uniq)
42 #echo $all
43 for f in $all; do
44 if [ -f $upstream_path/$f -a -f $local_path/$f ]; then
45 echo "FOUND IN BOTH :" $f
46 # diff -u $local_path/$f $upstream_path/$f
47 cp -v $upstream_path/$f $local_path
48 elif [ -f $upstream_path/$f ]; then
49 echo "FOUND IN UPSTREAM :" $f
50 cp -v $upstream_path/$f $local_path
51 $VCS add $local_path/$f
52 elif [ -f $local_path/$f ]; then
53 echo "FOUND IN LOCAL :" $f
54 $VCS rm $local_path/$f
56 done
60 fatal() {
61 echo "$1"
62 exit 1;
65 pwd | grep 'libsanitizer$' || \
66 fatal "Run this script from libsanitizer dir"
67 get_upstream
68 CUR_REV=$(get_current_rev)
69 echo Current upstream revision: $CUR_REV
70 merge include/sanitizer include/sanitizer
71 merge lib/asan asan
72 merge lib/lsan lsan
73 merge lib/tsan/rtl tsan
74 merge lib/sanitizer_common sanitizer_common
75 merge lib/interception interception
76 merge lib/ubsan ubsan
78 # Need to merge lib/builtins/assembly.h file:
79 mkdir -p builtins
80 cp -v upstream/lib/builtins/assembly.h builtins/assembly.h
82 rm -rf upstream
84 # Update the MERGE file.
85 cat << EOF > MERGE
86 $CUR_REV
88 The first line of this file holds the svn revision number of the
89 last merge done from the master library sources.
90 EOF