[cfe-dev] clang

David Blaikie dblaikie at gmail.com
Mon Nov 12 09:35:25 PST 2012


[+cfe-dev]

On Mon, Nov 12, 2012 at 2:23 AM, Janina <janina.siemer at gmx.de> wrote:
> Hi,
>
>
> I use LibClang and if I read the ast, the following Example are in the ast
> or not in the ast.
>
> This Example is in the ast:
> static STSRET StatusFktWert
>    (
>       VTYP          A,
>       STATUS16      B     ,                       /* aktueller Status der PV
> */
>       STATUS16      C     ,                     /* aktueller Status der PV 2
> */
>       STATUS32      D           ,      /* Statusmaske mit abzufragenden Bits
> */
>       INFO32       *E                                       /* Zg-> Ergebnis
> */
>    );
>
>
> This Example is not in the ast:
> static STSRET StatusFktWert
>    (
>       VTYP          aVtype,     // PV type
>       STATUS16      aPvState,   // aktueller Status der PV
>       STATUS16      aPvState2,  // aktueller Status der PV 2
>       STATUS32      aStateMask, // Statusmaske mit abzufragenden Bits
>       INFO32*       aResult,    // Zg-> Ergebnis
>       GETWERT       GetWertAME, // Pointer to GetWertSM or SimGetWert
>       SATZNR        aRecnum     // Record number
>    );
>         If I Use  clang -cc1 -ast-dump this one is not there, too.
>
>
> This IF-Else Condition is not in the ast:
>    if (ameld->status1.bit.TYP == ZWEI_BIT_ABME)
>       *zustand = AUSSTELLUNG;
>    else
>       *zustand = 0;
>
>         My speculation is, that the If-Condition is FAlSE, if I write
> if(1==1)..... the whole IF-Else Condition is in the ast.
>
> If I use clang -cc1 -ast-dump the If-Else Condition is there.

Sorry, I'm still having trouble following your examples as they are
incomplete (& I'm not terribly familiar with libclang's behavior - but
I would be surprised if it differs so wildly from -ast-dump as you
describe). It would be helpful if you could provide complete examples
(the entire source files - reduced to the simplest complete example -
that you're using as input, and possibly a reduced (but
standalone/complete) example of the libclang program you're using to
navigate the AST).

Perhaps you are navigating the CFG? (I don't know if libclang exposes
this - if it does, then you'll find that things that are trivially
compile-time unreachable won't appear in the CFG, this is by design)

- David

>
>
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: David Blaikie [mailto:dblaikie at gmail.com]
>> Gesendet: Montag, 12. November 2012 03:29
>> An: Janina
>> Cc: cfe-dev Developers
>> Betreff: Re: [cfe-dev] clang
>>
>> On Sat, Nov 10, 2012 at 8:17 AM, Janina <janina.siemer at gmx.de> wrote:
>> > Hi,
>> >
>> >
>> >
>> > if I build the ast from a C++ Code, some Nodes are not in the ast. Is
>> it
>> > possible that clang can´t read every Element from a C++ Code?
>>
>> Could you show some complete examples of the issue you're discussing?
>> (a simple, but complete, piece of code as well as the command(s) you
>> ran (you might want to try clang -cc1 -ast-dump as discussed here:
>> http://clang.llvm.org/docs/IntroductionToTheClangAST.html ) & the
>> output you got & the output you expected)
>>
>> >
>> >
>> >
>> > For example:
>> >
>> >  Variable1->Variable2
>> >
>> >  *Variable3
>> >
>> >
>> >
>> > Or like something other variants?
>> >
>> >
>> >
>> > Why do not the If/Else Condition get in the ast if the if-Condition
>> is
>> > false?
>> >
>> > If the If-Condition is false, so the else is not in the ast too.
>> >
>> >
>> >
>> > Regards
>> >
>> > Janina
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > cfe-dev mailing list
>> > cfe-dev at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> >
>




More information about the cfe-dev mailing list