[PATCH] D70864: update trailing newline treatment in clang-format.py

Paul Seyfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 03:03:05 PST 2019


pseyfert added a comment.

As a demonstrator I put this <https://gitlab.cern.ch/pseyfert/vim-clang-format-docker/container_registry> docker image together:

  docker run -it --rm gitlab-registry.cern.ch/pseyfert/vim-clang-format-docker:latest

open `vim Chi2PerDoF.h` and hit Ctrl+I. There is a blank line at the end of the file that does not get removed. If you run `clang-format-9 Chi2PerDoF.h` The empty line at the end of the file does get removed.
And you can try adding extra empty lines at the end of the file, running clang-format from vim (Ctrl+I) removes all but one empty line from the file. Running clang-format-9 from the command line removes all blank lines at the end of the file.

For what concerns testing with lit: no idea, I'm unfamiliar with the testing. I remember one can run vim macros also from the command line such that the reproducer wouldn't require user interaction, such that one can just run `vim -crazylookingoptions` and then diff the file against a reference. Haven't done that in years but if that would help I can look it up.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70864/new/

https://reviews.llvm.org/D70864





More information about the cfe-commits mailing list