Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Visiting IASTNodes inside preprocessor blocks

Hi folks,
I'm writting a plugin based in cdt/codan and i need to visit all IASTNodes in a C code. To do that I'm using the IASTTranslationUnit.accept method and it is working fine. But I also need to visit nodes inside a block excluded by the preprocessor (#ifdef, #ifndef) and the IASTTranslationUnit.accept is not doing this. In the example bellow bar() is visited, but foo() is not.

void main() {
    #ifdef VAR
        foo();
    #endif
    bar();
}

Is there a way to get the nodes from code inside this block? It seems to me that codan checkers do not work inside this block too, so looking at the code won't help me. I realize that I can get the preprocessor statements using IASTTranslationUnit.getAllPreprocessorStatements, but I cannot get the content.

Thanks,
Otavio Pontes


Back to the top