On Oct 10, 2012, at 10:40 AM, Sean Silva <[email protected]> wrote: >> - The 'kind' enums should be protected, not public. > > My reasoning here was that it might be convenient to allow clients to > switch over the enum. This is also what I have documented in > docs/HowToSetUpLLVMStyleRTTI.rst for precisely this reason. Is there a > particular reason you would prefer it to be protected? I'm mostly > interested for the sake of updating the documentation.
Only that it's bad OO style to switch on the leaves of a class hierarchy. It's bad enough that the LLVM-style RTTI requires the hierarchy to be enumerated in the base class, but at least the damage is centralized. A good compiler should be able to turn a chain of 'else if (isa<…>)' tests into a switch, and then you can subclass without updating all clients. /jakob _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
