From 6ef6edabc193d2651f889ace5c6ae392851e3d24 Mon Sep 17 00:00:00 2001 From: Laurence Tratt Date: Fri, 26 Apr 2024 17:10:05 +0100 Subject: [PATCH 1/2] Find clang-format if ykllvm is embedded as a submodule. --- yk_format_new_files.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/yk_format_new_files.sh b/yk_format_new_files.sh index 9f44961e78ac64..81e882e4e9b440 100644 --- a/yk_format_new_files.sh +++ b/yk_format_new_files.sh @@ -15,7 +15,20 @@ set -e YK_DIRS="./clang/test/Yk ./llvm/lib/Transforms/Yk ./llvm/include/llvm/Transforms/Yk llvm/lib/YkIR" +if ./build/bin/clang-format -version > /dev/null 2>&1; then + clang_format=./build/bin/clang-format +elif ../target/release/ykllvm/bin/clang-format -version > /dev/null 2>&1; then + clang_format=../target/release/ykllvm/bin/clang-format +elif ../target/debug/ykllvm/bin/clang-format -version > /dev/null 2>&1; then + clang_format=../target/debug/ykllvm/bin/clang-format +else + echo "Can't find clang-format" > /dev/null + exit 1 +fi +clang_format=$(readlink -f "$clang_format") +echo "Using $clang_format" + for dir in ${YK_DIRS}; do find ${dir} -type f -iname '*.cpp' -or -iname '*.h' -or -iname '*.c' | \ - xargs ./build/bin/clang-format -i + xargs ${clang_format} -i done From d745944a001dd90ce8a5f12f12887db01cfe1b0f Mon Sep 17 00:00:00 2001 From: Laurence Tratt Date: Fri, 26 Apr 2024 17:26:45 +0100 Subject: [PATCH 2/2] Give script the executable bit. --- yk_format_new_files.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 yk_format_new_files.sh diff --git a/yk_format_new_files.sh b/yk_format_new_files.sh old mode 100644 new mode 100755