| Hi Markus, The preprocessor constructs do not have a body in the sense 
of IASTNodes, they can intersect with ast-nodes at arbitrary points. Very often this is not the case, however 
we have to deal with those cases as well.   CDT cannot 
provide you with code completion in inactive code. You can figure out a reasonable settting for the macros 
used in your preprocessor conditionals and configure your project accordingly. You can also have different settings 
associated with different build configurations and switch back and forth between 
them.   There is some limited support to get AST for inactive code. 
Please consult the java-doc of ITranslationUnit.AST_PARSE_INACTIVE_CODE for 
that.   Markus. 
 
  
  
  Hi 
  together, my 
  name is Markus and I am currently working at a solution which can find the 
  elements inside of a preprocessor #if() body.
 Here 
  a small sample what I mean:
 
 void foo(void){
     #if(x) {
        int a;
     }
     #else ......  
}
With this part of code in the code completion list of the cdt 
  editor the element "a" isn't listed. Important to know is that the element "x" 
  has in my scope of the project no value. So it isn't possible for the 
  parser/preprocessor to know if the _expression_ is true or false and will add 
  the elements of the #else part to the ast. As I can get all preprocessor 
  statements from the IASTTranslationUnit I think there should be a way to 
  acquire also the body of such preprocessor #if statements with unknown 
  _expression_ result, isn't it. And that is the point for my idea. If I can get 
  out the preprocessor #if body of the cdt everything would be 
  fine.
Is 
  there a possibility to get this skiped part?  Thanks 
  in advance for all your support!!!!
 
 Cheers,
 Markus
 
 
 |