[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / lldb / scripts / framework-header-fix.sh
blob3459dd91c9ec1d13913002deef927aad306bcbf3
1 #!/bin/sh
2 # Usage: framework-header-fix.sh <source header dir> <LLDB Version>
4 set -e
6 for file in `find $1 -name "*.h"`
7 do
8 /usr/bin/sed -i.bak 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
9 /usr/bin/sed -i.bak 's|<LLDB/Utility|<LLDB|' "$file"
10 LLDB_VERSION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\1/g'`
11 LLDB_REVISION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\3/g'`
12 LLDB_VERSION_STRING=`echo $2`
13 /usr/bin/sed -i.bak "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
14 /usr/bin/sed -i.bak "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
15 /usr/bin/sed -i.bak "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
16 rm -f "$file.bak"
17 done