[cfe-dev] Missing statements in the Clang print AST

Miguel Aguilar miguel.aguilar at ice.rwth-aachen.de
Fri Jan 18 02:23:59 PST 2013


Hi,

I am trying to inspect the AST generated by clang of a simple C++ 
program. However in the body of the printed function are missing 
statements and functions call with respect to the original code. Can you 
tell me what parameters are missing while calling clang?

The clang command line that I am using is:

clang++ -cc1 -undef -ast-print pc/consumer.cc  -I/yapi-2.1.1/src/api

The output function is:

void main() {
     int n, j;
     for (int i = 0; i < n; i++) {
     }
}

The original code is:

void Consumer::main()
{
   int n,j,s;

   printf("Consumer started");

   // Simple test statement
   s = 5;

   read(in, n);

   for (int i=0; i<n; i++)
   {
     read(in, j);
     assert(i==j);
   }
}

Thanks,

Miguel



More information about the cfe-dev mailing list