Start a custom .clang-format rule
Also add clang-format-all.sh and clang-format-separate.sh to perform this operation.
These files sit in the ./src directory.
Bug: b/144825072
Change-Id: I5228ac59f7781ad1307c305949af7e7f9e0c31d1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/24308
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/clang-format-separate.sh b/src/clang-format-separate.sh
new file mode 100755
index 0000000..3f2a511
--- /dev/null
+++ b/src/clang-format-separate.sh
@@ -0,0 +1,15 @@
+SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+pushd ${SRC_DIR}
+for DIR in "Device" "Pipeline" "Reactor" "System" "Vulkan" "WSI"
+do
+ # Double clang-format, as it seems that one pass isn't always enough
+ find ${SRC_DIR}/$DIR -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.inl" | xargs clang-format -i
+ find ${SRC_DIR}/$DIR -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.inl" | xargs clang-format -i
+
+ git add ${SRC_DIR}/$DIR
+ CHANGE_ID="$(echo $CHANGE_ID_SEED $DIR | openssl sha1)"
+ git commit -m "clang-format the src/$DIR directory" -m "Bug: b/144825072" -m "Change-Id:I$CHANGE_ID"
+done
+popd
+