[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 12:29:57 PDT 2022


erichkeane added a comment.

If it is ok, I think we should probably change the format of the 'dump' for fields.  Using the colon to split up the field from the value is unfortunate, may I suggest replacing it with '=' instead?  As well as printing the size after a colon.  So for:

  void foo(void) {
    struct Bar {
      unsigned c : 1;
      unsigned : 3;
      unsigned : 0;
      unsigned b;
    };
  
    struct Bar a = {
      .c = 1,
      .b = 2022,
    };
  
    __builtin_dump_struct(&a, &printf);
  }

Output:

  struct Bar {
  unsigned int c : 1 = 1
  unsigned int : 3  = 0
  unsigned int : 0 = 
  unsigned int b = 2022
  }

What do you all think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122248



More information about the cfe-commits mailing list