[PATCH] D93839: [clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 10:48:16 PST 2021


leonardchan added a comment.

Hi. Up until this point, we've noticed that this patch can produce different formatted files depending on amount of whitespace. For example, given (A):

  #include <stdint.h>
  namespace fuzzing {}

`clang-format` with this patch would produced (B):

  #include <stdint.h>
  namespace fuzzing {
  }

but given (C):

  #include <stdint.h>
  namespace fuzzing {
  
  
  }

would be formatted to (D):

  #include <stdint.h>
  namespace fuzzing {
  
  }

The invocation specifically is `clang-format --style=google file`. Prior to this patch, both inputs (A/C) would give the same output:

  #include <stdint.h>
  namespace fuzzing {}

Is this unintended behavior and worth looking into? We have tests for generated code that use `clang-format` to attempt to "unify" expected and generated output for easy comparison. We would expect that extra whitespace not produce different formatted outputs. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93839



More information about the cfe-commits mailing list