Reputation: 5780
Basically the indent style I'd like to obtain is the one described as 'Lisp style' on Wikipedia:
while (x == y) {
something();
somethingelse(); }
I'm using a custom .clang-format
file (version 3.8) but I couldn't find any option suited for my need.
Thanks in advance.
Upvotes: 6
Views: 1914
Reputation: 16204
The clang-format source code is pretty clean, it's not too difficult to read it or modify it once you get the idea.
Here's a patch I made like a year ago that adds a "break before brace after constructor initialization lists", in clang 3.7. (It didn't get merged after discussion unfortunately, but I kept using it for my own projects anyways.) It's not too much code: https://github.com/cbeck88/clang/commit/e4f65cf7ab3deea9e6c7cdd5900ad0362835e514
Figuring out how to build clang and run the clang unit tests is probably as much work as actually making a patch to do what you are saying.
As I recall, the source code is more based around adding breaks rather than removing them, so depending on exactly how you want to formalize your idea (is this only control structures? For if's? For brace ending a function or class?) it might be tricky. But I still expect you would be able to get it to work.
To my recollection, there are no built-in options to do something close to what you are saying.
Upvotes: 4