Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force east const in clang format?

Is there a flag in clang-format to change 'const west' to 'east const', so that the following:

void fun(const std::string &s);

would be reformatted to:

void fun(std::string const &s);
like image 896
Marco M. Avatar asked Sep 12 '18 17:09

Marco M.


2 Answers

As of Clang-Format 14, there is QualifierAlignment. Add the following line to your .clang-format configuration file:

QualifierAlignment: Right
like image 100
John McFarlane Avatar answered Sep 19 '22 20:09

John McFarlane


AFAIK it isn't implemented yet, but there is a feature request in their bugtracker.

like image 37
magras Avatar answered Sep 22 '22 20:09

magras