[PATCH] D44093: [BUILTINS] structure pretty printer

Paul Semel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 7 05:41:14 PST 2018


paulsemel marked 2 inline comments as done.
paulsemel added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:1206
+    QualType Arg0Type = Arg0->getType()->getPointeeType();
+    const RecordType *RT = Arg0Type->getAs<RecordType>();
+
----------------
aaron.ballman wrote:
> You can use `const auto *` here because the type is spelled out in the initializer.
After thinking about it, I find it clearer to spell the full type when possible (that's also probably because I'm used to code in C :) )


================
Comment at: lib/CodeGen/CGBuiltin.cpp:1231
+      Types[getContext().VoidPtrTy] = "%p";
+      Types[getContext().FloatTy] = "%f";
+      Types[getContext().DoubleTy] = "%f";
----------------
aaron.ballman wrote:
> It's unfortunate that you cannot distinguish between `float` and `double`. Do you need to use the format specifiers exactly?
> 
> What about other type information, like qualifiers or array extents? How should this handle types that do not exist in this mapping, like structure or enum types?
So, I've think about it. What I am going to do is  that if I do not know the type of the field, I am just going to print it as a pointer. I know that it is not the best solution, but I think it's a okay-ish solution until I implement the other types.
For the qualifiers, at it is printed the same way with and without those, I can just add the entries in the DenseMap.


Repository:
  rC Clang

https://reviews.llvm.org/D44093





More information about the cfe-commits mailing list