[cfe-dev] Default case without predecessor

Zach Davis zdavkeos at gmail.com
Wed Jan 29 14:19:54 PST 2014


I believe the edge from the switch to the default case is pruned because
all of the enum values are covered by the switch.  The analyzer is
considering the default case as "not possible".

Zach


On Wed, Jan 29, 2014 at 12:33 PM, Panke <tobias at pankrath.net> wrote:

> Hi,
>
> If I run clang on the code below, either via my own FrontendAction and
> libtooling or just with
> clang -cc1 -analyze -analyze-checker debug.DumpCFG I get an CFG where the
> default case
> has no predecessor. If I compile the code to llvm and dump a CFG from opt
> then all cases
> are successors of the switch.
>
> Is it possible to obtain a CFG from clang with all edges for the switch
> statement?
>
> cheers,
> Panke
>
> --
> typedef enum E
> {
>         A,
>         B
> } E;
>
> int foo(E e)
> {
>         switch(e)
>         {
>                 case A:
>                         return 12;
>                 case B:
>                         return 42;
>                 default:
>                         return 1242;
>         }
>         return 0;
> }
> --
>
>
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Default-case-without-predecessor-tp4037484.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140129/050e7d9a/attachment.html>


More information about the cfe-dev mailing list