<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56736>56736</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Non-zero exit code when formatted correctly.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sridhargopinath
</td>
</tr>
</table>
<pre>
Below is a sample commit to showcase the bug. There are two lines added that conform to clang-format formatting.
```
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index f5039eb5126c..0e3f24fe4aa9 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1647,6 +1647,8 @@ void AtomicRMWInst::Init(BinOp Operation, Value *Ptr, Value *Val,
"Ptr must be a pointer to Val type!");
assert(Ordering != AtomicOrdering::NotAtomic &&
"AtomicRMW instructions must be atomic!");
+ assert(Ordering != AtomicOrdering::NotAtomic &&
+ "AtomicRMW instructions must be atomic!");
}
AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
```
Running clang-format on the commit does not show any formatting changes. However, it returns non-zero exit code.
```
➜ clang/tools/clang-format/git-clang-format -v --binary /path/to/clang-format --diff HEAD~1 HEAD
Running clang-format on the following files:
llvm/lib/IR/Instructions.cpp
old tree: HEAD
new tree: 98edebbef1ca81ada0b968a3c0d65bbb6920cd59
➜ echo $?
1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVU1v4zYQ_TX0hZAgUd8HHex1gt1DN0VQdM-kOLJYyKRAUvGmv75DyfHaSYCmuxVoUSTnDR9n-MbCyOd2B6M5UeUop44fpxFoZ45H5ak31A3m1HEH1A9AxXyI6R8DWKAcf_5k6Kg0IFBKkGjCPUJ1b-wxYLuR60MURji_dl7pQ0ySPUm2pEzObRlK1fc0ig64LSfsfhyfjqFTAt9fHs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