How can I apply only one clang-format action?

I think clang format was simply not designed for this. Rules are not things it applies incrementally, the program is instead built around, parsing your entire program and forgetting (most of) the old whitespace, and generating new whitespace based on the rules you select.

You can see some overview of the architecture here: http://www.llvm.org/devmtg/2013-04/jasper-slides.pdf

First it runs clang lexer and parser, then it divides groups of tokens into "unwrapped lines" which are "tokens we would like to put together on a single line if there was no column limit". Then a layouter determines the formatting of each unwrapped line based on the various constraints and optimizing for the various penalties.

So, I don't think "one clang-format action" is actually a thing, the design looks pretty much monolithic to me.


clang-format does not have a mechanism to do this. The palliative I use is to configure what I want changed in two different ways, I run the tool with both configurations and diff them, that tells me the changes that affect what I want, but in general this requires at least some manual work.

clang-format is a good idea with a poor implementation. Some of the many deficiencies it has are that there is no option to have it indicate the reason for a change, the XML output format is not consumable by any other popular tool...