Open Quuxplusone opened 6 years ago
Bugzilla Link | PR37478 |
Status | NEW |
Importance | P normal |
Reported by | Akhil Indurti (aindurti@gmail.com) |
Reported on | 2018-05-15 16:04:15 -0700 |
Last modified on | 2019-01-31 06:14:25 -0800 |
Version | unspecified |
Hardware | Macintosh MacOS X |
CC | aindurti@gmail.com, djasper@google.com, joe.jordan@picotech.com, klimek@google.com, llvm-bugs@lists.llvm.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
I have noticed the same non-deterministic behaviour around single-line comments.
I have found the minimal config file which reproduces the bug as I observe it:
$ cat .clang-format
---
Language: Cpp
BasedOnStyle: Mozilla
AlignTrailingComments: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
ReflowComments: false
...
and here is an example of the bug as reported above:
$ cat test.cpp
void main() {
function_call_with_really_long_name_aaaaaaaa(lots, of arguments_with_long_names, which, must_be_split_up, and_with); // a comment up here
// and another indented here.
}
$ clang-format test.cpp > format1.cpp
$ cat format1.cpp
void main()
{
function_call_with_really_long_name_aaaaaaaa(lots,
of arguments_with_long_names,
which,
must_be_split_up,
and_with); // a comment up here
// and another indented here.
}
$ clang-format format1.cpp > format2.cpp
$ cat format2.cpp
void main()
{
function_call_with_really_long_name_aaaaaaaa(lots,
of arguments_with_long_names,
which,
must_be_split_up,
and_with); // a comment up here
// and another indented here.
}
$ diff format1.cpp format2.cpp && echo 'two passes match' || echo 'two passes
were different'
9c9
< // and another indented here.
---
> // and another indented here.
two passes were different
We also saw a similar issue with whitespace inside comments, which is why we
disabled ReflowComments (the first pass would reflow the comment but not add
correct whitespace, which the second pass would fix. If you would like a
minimal repro for that as well, I could make one.)
It would be useful to have a response about how this issue is being prioritised
(if at all). We are trying to introduce this tool into our CI, and the non-
determinism is a stumbling block (multiple passes means our builds will take
longer.)
Thank you,
Joe Jordan