Running clang-format should ideally idempotent, i.e. if I run it, then run it again, the results of the first and second run should be identical. This is currently not the case in the following example: -- 8< -- int test() { int foobar = 0; /* comment */ int foo = 0; /* comment */ int bar = 0; /* this is a multiline comment and the later vars are shorter */ int qux = 0; /* comment */ } -- 8< -- After running clang-format --style=LLVM on this, you get this: -- 8< -- int test() { int foobar = 0; /* comment */ int foo = 0; /* comment */ int bar = 0; /* this is a multiline comment and the later vars are shorter */ int qux = 0; /* comment */ } -- 8< -- Each run, the line before variable qux gets a little bit less indented. After enough, the process finally stabilizes at this version: -- 8< -- int test() { int foobar = 0; /* comment */ int foo = 0; /* comment */ int bar = 0; /* this is a multiline comment and the later vars are shorter */ int qux = 0; /* comment */ } -- 8< -- I am using clang SVN revision 205521, llvm rev 205525, on Mac OS X 10.8.5.
I can reproduce the behavior. Alex, can you take a look?
Yes, that's weird, will take a look at it today.
Fixed in r206472.