Skip to content

[clang-format] Non-zero exit code when formatted correctly. #56736

@sridhargopinath

Description

@sridhargopinath

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: 98edebbef1ca81ada0b968a3c0d65bbb6920cd59echo $?            
1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions