One way of doing it is by using CallExpr
to identify printf calls.
You would use getArgs()
instead of getArg(0)
and use an iterator to parse through the arguments.
const Expr* expr = CE->getArg(0); //CE is the CallExpr for printf
if (const ImplicitCaseExpr* ICE =
llvm::dyn_cast<ImplicitCastExpr>(expr)) {
const Expr* DRE_VAR = ICE->getSubExpr();
//now, cast and parse the AST
}
EDIT: Looking at this a couple of months later, I can tell you that the only way to do this would be for you to do the placeholder mapping.