clang-format currently moves all pragmas to the first column. An example before clang-format:
for (int i = 0; i < 4; ++i) {
#pragma UNROLL
// ...some code...
}
The same code after clang-format:
for (int i = 0; i < 4; ++i) {
#pragma UNROLL
// ...some code...
}
Is there a way to have clang-format ignore pragma lines entirely without changing the source code (i.e. without cluttering the source with // clang-format off
)? For example with a regular expression?
This is related to this question (I would like to avoid installing a third-party tool), and will hopefully be resolved by this bug report.
Additionally, while clang-format off
is respected for the line with the pragma, the commented line itself will get indented to what the pragma would have been indented to (with clang-format 6.0.0):
for (int i = 0; i < 4; ++i) {
// clang-format off
#pragma UNROLL
// clang-format on
// ...some code...
}