[PATCH] D121451: [clang-format] Add space to comments starting with '#'.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 03:22:04 PDT 2022


sammccall added a comment.

In D121451#3402167 <https://reviews.llvm.org/D121451#3402167>, @curdeius wrote:

> You comment the whole block and it becomes (with this patch):
>
>   // #include <header.h>
>   //
>   // int something;
>
> whereas it was:
>
>   //#include <header.h>
>   //
>   // int something;
>
> which seems inconsistent at least.

A fun wrinkle here is is that if you originally wrote (note no blank line):

  //#include <header.h>
  //int something;

and ran old clang-format, you get (and checked in)

  //#include <header.h>
  // int something;

and now if you run new clang-format, the second line gets an *extra* space to preserve the indent:

  // #include <header.h>
  //  int something;

I don't think this is worth fixing, had me scratching my head though :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121451



More information about the cfe-commits mailing list