Open mattco98 opened 4 months ago
Almost certainly a dupe of #92657.
Almost certainly a dupe of https://github.com/llvm/llvm-project/issues/92657.
Maybe, but if you replace the macros in the example with __attribute__((whatever))
, it formats as expected.
e: I might have been unclear; this is specifically in regards to macros. The example is also formatted correctly if you replace the macros with [[...]]
clang-format works on a lexer level. It doesn't do preprocessing. It does not know about macros. If you put a ->
after the __attribute__
(as in the other issue), that doesn't get formatted either. I'm guessing that it looks like the attribute works because it treats that as the name of the lambda and then parens of the attribute as the parameter list.
I'm guessing that this needs a call to handleAttributes()
(or similar) somewhere in tryToParseLambda()
when it's done parsing the capture.
Oh sorry, didn't see that you have a patch out for this already!
I would expect the following code to be untouched:
However, the file gets formatted as:
Lambdas without parameter lists seems to be formatted correctly, though that's not surprising as that was a valid position for attributes before C++23.
Tested on the latest commit (e90126e0dd6f058e1602bb6c769dfa4c52d7ad47)