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
Assertion failed: Shift >= 0, file C:\src\llvm_package_303050\llvm\tools\clang\lib\Format\WhitespaceManager.cpp, line 245 #32854
Comments
I can reproduce with trunk and 5.0 but not 4.0, so this is a regression. Daniel: is there someone besides yourself who like looking into clang-format bugs? :-) |
*** Bug llvm/llvm-bugzilla-archive#34071 has been marked as a duplicate of this bug. *** |
I have made an workaround for me - simply commented out this assert. And it looks quite normal. I don't know why. :) |
Some blame history:
This means only four revisions left, most likely rev 298574 by nikola:
Indeed, a quick check confirms that rev 5.0.0.300231 is also affected. |
+Nikola |
krasimir: Maybe you could take a look? |
It seems to misformat the test case if I do that: $ cat | bin/clang-format -style="{BasedOnStyle: Mozilla,AlignConsecutiveDeclarations: 'true'}" Note that it breaks the code by concatenating "Version" and "verVs2017" :-( |
Confirmed that both the assert and the concatenation started with r298574. |
Hello, I've sent this patch for review if anyone wants to give it a try: https://reviews.llvm.org/D37137 |
Sorry, didn't see your post/patch before I commented, but I tested it with my test case and it works great... |
The patch was committed in r311792. I'll let it bake a little bit and then merge. |
Merged in r311800. Thanks for fixing! |
mentioned in issue #33196 |
mentioned in issue llvm/llvm-bugzilla-archive#34071 |
Extended Description
We have a dozen of C++ files with some lambdas that make clang-format crash.
One example is this code:
auto found = range::find_if(vsProducts, [&](auto * aProduct) {
static const Version verVs2017;
return true;
});
If I add this code to another C++ file and try to format (on save), it will crash and create a dump file. (the example code was reduced, but still two lines)
I've trimmed the config file to just these two lines to reproduce the problem:
BasedOnStyle: Mozilla
AlignConsecutiveDeclarations: 'true'
Thanks
The text was updated successfully, but these errors were encountered: