aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
authorConrad Donahue <conradjdonahue@gmail.com>2023-11-08 21:13:03 -0500
committerGitHub <noreply@github.com>2023-11-08 18:13:03 -0800
commit68d618f908458e7513e2a56be292216ea0e4ef3f (patch)
treec3cefc2a13d50ed5529baac2562c2d79d2d657f4 /clang/tools/clang-format/clang-format-diff.py
parentd36eb79ccc623d7f56b49ab878cff6f3eba14eef (diff)
downloadllvm-68d618f908458e7513e2a56be292216ea0e4ef3f.zip
llvm-68d618f908458e7513e2a56be292216ea0e4ef3f.tar.gz
llvm-68d618f908458e7513e2a56be292216ea0e4ef3f.tar.bz2
[clang-format] Add ability for clang-format-diff to exit with non-0 status (#70883)
This patch adds the ability for the clang-format-diff script to exit with a non-zero status if it detects that formatting changes are necessary. This makes it easier to use clang-format-diff as part of a DevOps pipeline, since you could add a stage to run clang-format-diff and fail if the formatting needs to be fixed.
Diffstat (limited to 'clang/tools/clang-format/clang-format-diff.py')
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index 324ef5b..892c1e3 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -185,6 +185,7 @@ def main():
diff_string = "".join(diff)
if len(diff_string) > 0:
sys.stdout.write(diff_string)
+ sys.exit(1)
if __name__ == "__main__":