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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 14:20:24 PDT 2022


rsmith added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2046-2048
 static llvm::Value *dumpRecord(CodeGenFunction &CGF, QualType RType,
                                LValue RecordLV, CharUnits Align,
+                               bool dumpTypeName, llvm::FunctionCallee Func,
----------------
Instead of passing a flag that suppresses the first section of this function, it would be clearer to split this up into two parts:

1) A function that dumps a type name (`struct A` or `int` or whatever).
2) A function that dumps a struct value (`{x = 1, y = 2}`).

Then when printing the overall value, you can call (1) then (2), and when printing each field, you can call (1), then print the field name, then call (2) for a struct value (and do whatever else makes sense for other kinds of values).


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