I'm using clang-format (version 8.0.0 (tags/google/stable/2019-01-18)
) with a style file, in which I set
…
PointerAlignment: Left
…
This succeeds in transforming declarations such as this one
const string &foo = "lorem ipsum";
into
const string& foo = "lorem ipsum";
However, when I also include in my style file
BasedOnStyle: Google
the options do not do anything. For some reason, they get overridden by the base style. This seems nonsensical to me – the explicit options should override the base style instead, no?
Can somebody explain what the problem is and how to use both BasedOnStyle
and PointerAlignment: Left
?
PointerBindsToType
is legacy (is not anymore there in the documentation, you have to go back to previous versions to see it, for example 3.4), just usePointerAlignment
(eitherLeft
,Right
orMiddle
). – ZinnPointerBindsToType
is still a supported option but it is a legacy option. If you use at the same timePointerAlignment
andPointerBindsToType
the first one will make the second irrelevant. In the version you mention (8),PointerBindsToType
was already made legacy (and therefore not mentioned in the documentation): releases.llvm.org/8.0.1/tools/clang/docs/… This question has more value if it shows cleaner usage of clang-format. – Zinn