[PATCH] D85144: [clang] Improve Dumping of APValues

Tyker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 12:18:13 PDT 2020


Tyker updated this revision to Diff 283984.
Tyker marked an inline comment as done.
Tyker added a comment.

this a patch i had to improve dumping before your improvement to dumping.

I think there is benefits to being able to dump APValues like LValues without an ASTContext even if the output will not be as good. but i agree that now that the dumper has an ASTContext during ast-dump it is hard to test.

In D85144#2191440 <https://reviews.llvm.org/D85144#2191440>, @riccibruno wrote:

> Thanks for finishing this.
>
> I don't see why you are adding `dumpPretty`; the point of the `dump` function I added is to dump the `APValue` as the tree-like structure it is. But your `dumpPretty` doesn't do that at all.

the intent was to reuse the same printing code that is already used for diagnostics (printPretty) since it can print Member pointers and LValues. it isn't being used for printing anything that isn't a leaf(as in no child APValues) when used in AST dump. maybe the name is the issue here.

> So `dump` does one thing and `dumpPretty` does another completely different thing.

i removed dumpPretty and instead added a new overload to printPretty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85144

Files:
  clang/include/clang/AST/APValue.h
  clang/include/clang/AST/PrettyPrinter.h
  clang/lib/AST/APValue.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/test/AST/ast-dump-APValue-LValue.cpp
  clang/test/AST/ast-dump-APValue-MemPtr.cpp
  clang/test/AST/ast-dump-APValue-todo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85144.283984.patch
Type: text/x-patch
Size: 18219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200807/eaf5b41e/attachment-0001.bin>


More information about the cfe-commits mailing list