Skip to content

Commit

Permalink
Merge pull request rust-lang#143 from ltratt/find_clang_format
Browse files Browse the repository at this point in the history
Find clang-format if ykllvm is embedded as a submodule.
  • Loading branch information
jacob-hughes authored Apr 26, 2024
2 parents d2eab13 + d745944 commit 6472aa1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion yk_format_new_files.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6472aa1

Please sign in to comment.