[cfe-dev] accessing if-condition from if-statement node in libclang

Juan Jose Lopez Villarejo jj.lopezvillarejo at cern.ch
Thu May 29 10:28:51 PDT 2014


Hello,

I’m using libclang for a visual documentation tool for C++ codes, Flowgen, under current development.

I'd like Flowgen to access automatically the condition of an if-statement. Example:

if ( varMax == 4 &&
    varOther ==2 ) {
     std::cout << "test";
  } else if{
     std::cout << "test1";
  } else {
     std::cout << "test2";
  }

Imagine that I have accessed the if-statement node/Cursor with libclang
#clang node types (CursorKind)
#205: if statement

I'd like to have (direct) access to the string "varMax == 4 && varOther ==2".
I'd like to have (direct) access as well to the else-if node and the else node.
Anyone knows how? Thank you and best regards,

Juan J. Lopez-Villarejo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140529/b8b6b034/attachment.html>


More information about the cfe-dev mailing list