[PATCH] D72557: Add pretty printers for llvm::PointerIntPair and llvm::PointerUnion.
Christian Sigg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 02:00:22 PST 2020
csigg added inline comments.
================
Comment at: llvm/utils/gdb-scripts/prettyprinters.py:349
+ """Factory for an llvm::PointerIntPair printer."""
+ for (pointer, value) in get_pointer_int_pair(val):
+ pointer_type = val.type.template_argument(0)
----------------
dblaikie wrote:
> Is this an idiomatic way to handle the "function that returns a thing or nothing"? It looks a bit quirky (it's a loop that's only ever intended to iterate once) & I wouldn't mind understanding better how/if this is idiomatic python (if you've got a link to some references about this) before committing it.
I don't know, and I couldn't find anything online. It did look pretty clean to me, but I'm not attached to it.
There is this discussion whether std::optional could be modeled as container of 0 or 1 element. And quite a few people were concerned that using it in a for loop is confusing:
https://www.reddit.com/r/cpp/comments/6uw5ny/stdoptional_and_container_interface/
Changing it to return a tuple of None.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72557/new/
https://reviews.llvm.org/D72557
More information about the llvm-commits
mailing list