r215128 - Mark successors as reachable/unreachable instead of changing the CFG.

Ted Kremenek kremenek at apple.com
Thu Aug 7 13:03:16 PDT 2014


> On Aug 7, 2014, at 12:42 PM, Manuel Klimek <klimek at google.com> wrote:
> 
> Specifically for -Wreturn-type, the change I proposed should not impact that warning at all.
> 
> If the change didn't affect this at all, we'd have loads of false positives for Wreturn-type, because it uses the reachability analysis to figure out whether anything falls out at the end of the function... 
> 

Sorry, what I meant to say is that using addSuccessor() in the way I suggested should not have caused a functionality regression in -Wreturn-type.  For that analysis the blocks still appear unreachable.  We're probably saying the same thing.

Looking at this case again:

> int testConditionallyExecutedComplexTernaryTrueBranch(bool value) {
>   value || (true ? NoReturn() : true);
> -} // expected-warning {{control may reach end of non-void function}}
> +}


It seems like we should still be emitting a warning here.  The variable 'value' is not known to true or false; this means that we can reach the end of the function without hitting return if 'value' was 'true'.  In other words, NoReturn() does not dominate all exits from the function, and thus we should warn here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140807/608ed5ec/attachment.html>


More information about the cfe-commits mailing list