Endilll wrote:

> What other ways are to make a const void * debugger-friendly - other than 
> llvm::PointerUnion?

I'm not aware of any that wouldn't require writing a custom formatter. 
Ultimately it boils to how can I extract type information. For 
`llvm::PointerUnion` I'm matching discriminator against template argument list 
after jumping through some hoops to get discriminator as a number. If this 
patch allows me to extract type information based on prefix or suffix of `Kind` 
enumerator, then it's probably as easy as you can get it without a radical 
change. But read on, there's more to this.

> I've considered using plain-old unions, but I found that approach pretty 
> ugly, and I'm not even sure if it would help debugging experience.

Given I extracted type information from `Kind`, now I need a handle to type to 
cast the pointer to.

In order to declare a union, you have to specify type of every member. It's 
possible to extract type from such declaration, saving debugger the time to run 
global search for a type by name, which in my experience is about two orders of 
magnitudes more expensive operation than anything else formatter usually does 
(anecdotal evidence of 100 ms per search). So in order to keep debugger 
responsive with formatters enabled, I'm avoiding global searches as much as I 
can.

For debuggers having union with all possible types listed is strictly an 
improvement over status quo, but I get why this is ugly.

https://github.com/llvm/llvm-project/pull/71039
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to