[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

Wang Yihan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 03:03:46 PDT 2022


yihanaa added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:174
   - Improve the dump format, dump both bitwidth(if its a bitfield) and field value.
-  - Remove anonymous tag locations.
-  - Beautify dump format, add indent for nested struct and struct members.
+  - Remove anonymous tag locations and flatten anonymous struct members.
+  - Beautify dump format, add indent for struct members.
----------------
I tried it, D124221 will still generate anonymous tag locations, this place needs to be corrected, or removed anonymous tag locations.

int main() {
  struct U20A {
    _Bool a;
    unsigned : 32;
    struct {
      int x;
      int y;
    } c;
  };

  struct U20A a = {
      .a = 1,
      .c.x = 1998
  };
    __builtin_dump_struct(&a, printf);
}

struct U20A {
    _Bool a = 1
    struct (unnamed struct at ./builtin_dump_struct.c:10:5) c = {
        int x = 1998
        int y = 0
    }
}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124221



More information about the cfe-commits mailing list