I just started to learn Clang. I am trying to use clang (version 3.0) to process code to extract some stmt and print them out.
When I use printPretty() of stmt for a stmt as following:
x = 1.0f/3.0f;
Would anyone help me to know what i should do to keep the “.0” in the dumped code. I tried to look through PrintingPolicy struct, but have no idea for this…
Thank you very much for reading this and looking forward to get your kindly help.
Pretty-printing and dumping code exists mainly for debugging (to
inspect AST nodes in the debugger) and has almost no tests. So it is
not a surprise that we print something incorrectly.
Patches are always welcome! If you are interested in fixing this,
take a look at StmtPrinter::VisitFloatingLiteral function.
The sad truth is that I've already provided a patch for exactly that problem some month ago. And after nobody cared here, I retried at cfe-commits. Same result: nobody cared.
Seems like I missed it then. Do you have commit access or you need
someone to commit it for you?