Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running clang-format once produces different output from running it twice, on some inputs #58202

Closed
bzbarsky-apple opened this issue Oct 6, 2022 · 1 comment · Fixed by #127159

Comments

@bzbarsky-apple
Copy link

bzbarsky-apple commented Oct 6, 2022

Consider this minimal Objective-C header:

#import <Foundation/Foundation.h>

@interface Foo : NSObject

/**
  */- (void)foo;

@end

If I run clang-format on it once, I get this diff against the original file:

@@ -3,6 +3,7 @@
 @interface Foo : NSObject
 
 /**
-  */- (void)foo;
+ */
+-(void)foo;
 
 @end

If I now run it again, I get this diff against the output of the first run:

@@ -4,6 +4,6 @@
 
 /**
  */
--(void)foo;
+- (void)foo;
 
 @end

Ideally, running clang-format would be idempotent, so that CI that runs clang-format on the tree and fails on any observed changes can work correctly.

@llvmbot
Copy link
Member

llvmbot commented Oct 6, 2022

@llvm/issue-subscribers-clang-format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants