[cfe-users] clang-format: Preserve horizontal whitespace?

Michael W√ľnsch liganic-clang at gmx.org
Sat Jun 14 12:57:51 PDT 2014


Hey everyone,
I'm trying to get clang-format to preserve horizontal whitespace. For
example:

void main() {
  int FOO       = 1;
  int BAR       = 2;
  int VERY_LONG = 3;
}

gets mushed into (using -style=Google as an example):
void main() {
  int FOO = 1;
  int BAR = 2;
  int VERY_LONG = 3;
}

The (Google) Styleguide
(https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) says:

"// Assignment operators always have spaces around them."

This means at least one, not exactly one. clang-format however always
consumes all horizontal whitespace and merges it into one space.

Is there any way to fix this?

Regards,
-- 
Michael



More information about the cfe-users mailing list