[PATCH] D48807: Add llvm::Any

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 10:41:23 PDT 2018


dblaikie added a comment.

> So we give back the user an event object that has as wide of a common interface as possible, but still doesn't prevent access to all of the bits.  The consumer of the common interface will be common code.  Code that wants to decide what to do after hitting a breakpoint probably doesn't need all this platform specific information.  It can just stop, look up line and symbol information based on the address, and report it to the user.  But in a system like this which has deep hooks into the OS, it will be very frequent that the code handling an event needs to do something completely different depending on the platform.  So we branch out into platform specific code, and in that platform specific code we know how to consume the platform specific event data.

Sounds pretty much the same as what LLVM's codebase would use polymorphism for (& dyn_cast, dyn_cast if chains, or switch over the type+cast, etc) since its inception. Some common API & some specific stuff that certain consumers care about. Doesn't necessarily mean it's the right way to do it - but there's certainly a lot of precedent (admittedly implemented before something like Any was as commonly thought about in C++, maybe).

Wouldn't mind hearing some other perspectives in here - I'm still a bit reticent, but happy enough to sign off (once the technical feedback is addressed) if you're really feeling it.


https://reviews.llvm.org/D48807





More information about the llvm-commits mailing list