Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] get AST nodes of a macros

A macro definition can be an arbitrary sequence of tokens that does not have to satisfy any restrictions imposed
by a grammar. Therefore there is no AST for a macro.
 
Markus.
 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Jimmie Eriksson
Sent: Wednesday, April 08, 2009 12:57 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] get AST nodes of a macros
Importance: Low

hi all

Is it possible to get macro code converted into an AST? or is it bound to be text?

Consider the following macro, when creating an AST of the c code below, the macro is not converted into AST nodes.
Only a weak structure (IASTPreprocessorMacroDefinition) containing position where it is "called" and where to find the code for the macro is all that is provided.
Is it possible to get the AST nodes of a macro? any sugestions anyone? please..

#define BIARI_CTX_INIT2(ii,jj,ctx,tab,num) \
{ \
  for (i=0; i<ii; i++) \
  for (j=0; j<jj; j++) \
  { \
    if      (img->type==I_SLICE)  biari_init_context (&(ctx[i][j]), &(tab ## _I[num][i][j][0])); \
    else                            biari_init_context (&(ctx[i][j]), &(tab ## _P[num][i][j][0])); \
  } \
}

void foo() {
  BIARI_CTX_INIT2 (3, NUM_MB_TYPE_CTX,   mc->mb_type_contexts,     INIT_MB_TYPE,    img->model_number);
}

/Jimmie

Back to the top