[cfe-dev] -Wunreachable-code and templates

Ted Kremenek kremenek at apple.com
Wed Nov 30 23:49:56 PST 2011


On Nov 30, 2011, at 6:18 PM, Richard Smith wrote:

> It seems like we're no longer moving in this direction, but for posterity the
> idea was to use the InstantiationDependent bit to indicate (as it currently
> does) whether an Expr node is dependent, and if that bit is 0, use the
> ValueDependent/TypeDependent bits to indicate if the node was instantiated
> from a dependent node.


This may be generally useful, but I'm dubious that analyzing templates for unreachable code is really worth the payoff of the complexity it will incur.  I painted a picture earlier of how instantiated code could have wildly different control-flow, but how much should we care about those issues in practice?  At the very least, however, we may get different CFGs for different template instantiations that have different basic blocks, different quantities of basic blocks, etc.  We'd need to correlate those results together to get reasonable results, and then that doesn't necessarily prove that the original template contains dead code  I'm skeptical that doing all the extra work to get this to dance for template instantiations will really be worth it compared to handling the common edge cases that happen in everyday code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111130/07957b97/attachment.html>


More information about the cfe-dev mailing list