[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

Wang Yihan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 09:41:04 PDT 2022


yihanaa added a comment.

In D122920#3426556 <https://reviews.llvm.org/D122920#3426556>, @erichkeane wrote:

> I don't particularly get what the 'fix' is here to Richard's issue.  Additionally, I think this is showing me the absolute desperate need we have for some sort of 'text-checking' tests for this feature, checking vs the IR is too unreadable.

Thanks for review!  The issue that @rsmith reported was when the struct field is a record type, the __builtin_dumpr_struct no longer prints the field name. 
Eg:
The code:

  #include <stdio.h>
  
  struct A {
      int x;
  };
  
  struct B {
      struct A a;
  };
  
  
  int main() {
      struct B x = {0};
      __builtin_dump_struct(&x, &printf);
  }

The clang trunk:(This missing field name 'a' for type struct A), our expected output is 'struct A a = {')

  struct B {
      struct A {
          int x = 0
      }
  }

After this patch:

  struct B {
      struct A a = {
          int x = 0
      }
  }

I try to improve this comment. And do you think it would be better to name this boolean 'includeTypeName'?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122920



More information about the cfe-commits mailing list