[cfe-dev] clang-format not to eat up spaces before // clang-format off

Peng Yu via cfe-dev cfe-dev at lists.llvm.org
Sun Feb 17 14:13:22 PST 2019


Hi,

I'd like to indent some flex files. In the following example, the
first "// clang-format off" must not start from the beginning of the
line. But clang-format will eat up the spaces from "// clang-format
off". Is there a way to keep the spaces before ""// clang-format off"?

$ clang-format < indent.l
// clang-format off
%option main noinput nounput
%%
. {
  // clang-format on
  while (0) {
    int a;
    a += 1;
  }
  // clang-format off
}
$ cat indent.l
   // clang-format off
%option main noinput nounput
%%
. {
  // clang-format on
while(0){int a;a +=                       1;}
  // clang-format off
}

-- 
Regards,
Peng



More information about the cfe-dev mailing list