[cfe-users] the case of the missing label in the switch/case

folkert via cfe-users cfe-users at lists.llvm.org
Wed Nov 9 08:00:50 PST 2016


The problem is that you were using CaseStmt::getRHS instead of
CaseStmt::getSubStmt.
No idea what getRHS is supposed to return then.

On Wed, Nov 09, 2016 at 09:53:28AM +0100, folkert via cfe-users wrote:
> Hi,
> 
> I maybe very well not understanding something but it looks like a label
> targetted by a goto, in a switch statement, gets missing: if I iterate
> through the ast and emit all the stmt/expr/decls, then no label-type is
> emitted.
> 
> #include <stdio.h>
>  
> void myfunc(int a)
> {
>         switch(a) {
>                 case 1:
>                         printf("1\n");
>                         goto my_label;
>  
>                 case 2:
>                         break;
>  
>                 case 3:
> my_label: // this label does not appear in the ast
>                         printf("Hello, world!\n");
>         }
> }
> 
> 
> any ideas?
> 
> 
> Folkert van Heusden
> 
> -- 
> ----------------------------------------------------------------------
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Folkert van Heusden

-- 
To MultiTail einai ena polymorfiko ergaleio gia ta logfiles kai tin
eksodo twn entolwn. Prosferei: filtrarisma, xrwmatismo, sygxwneysi,
diaforetikes provoles. http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com



More information about the cfe-users mailing list