Getting macro values, and processing CallExpr with arguments of types from included headers
Posted similar questions 2 days ago, this time more detailed.
I'm working on a tool for src-2-src transformations. One of the functions of this tool is replacing function calls in the code.
I'm having problems with this operation whenever one of the arguments of the call is a macro, or of a type declared in an included header:
To get the value of arguments I get it's SourceRange, and get the associated code using SourceManager::getCharacterData. That usually works, but when it's a macro I get an error: "terminate called after throwing an instance of 'std::length_error' what(): basic_string::_S_create ".
In order to replace function calls, I use StmtVisitor to find all CallExpr. The problem is when one of the arguments is of a type declared in an included header, this call, for some reason, is ignored and not visited.
Both this issues concern pre-processing, so I have a principle question- when accessing the AST wiith ASTConsumer, is it after the pre-proccessing phase?
Thanks in advance, any help will be greatly appreciated,