[cfe-dev] clang-format behaviour w/ blank lines.

Maurizio Vitale via cfe-dev cfe-dev at lists.llvm.org
Mon Jul 17 05:32:29 PDT 2017


#include <iostream>

    int


main(int    argc,char**argv    ) { std::cout <<"Hello"  ;
}

is formatted by clang-format 3.9 (from debian, but confirmed w/ a 4.0
compiled by me) as:
[this w/ all default]

#include <iostream>

int


main(int    argc,char**argv    ) {
  std::cout << "Hello";
}

removing the extra white lines, hence starting from:

#include <iostream>

    int
main(int    argc,char**argv    ) { std::cout <<"Hello"  ;
}

gives:

#include <iostream>

int main(int argc, char **argv) { std::cout << "Hello"; }

so it looks like extra blank lines prevents clang-format from reformatting
anything at all, which is not what I would have expected.

Two question:

1. can other people confirm this, as it might be a quirk of my environment
2. is it intended? If it is only between type and function it is probably
not a big deal in practice.

Thanks,

  Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170717/ee902b2b/attachment.html>


More information about the cfe-dev mailing list