Dump AST without control codes


I am using the clang C++ api to dump filtered declarations to a file using decl->dump(f). The problem I am encountering is the resulting file contains control codes to colorize the display. Is there any way to programmatically dump the ast to achieve the same effect as:

'clang -Xclang -ast-dump -fno-diagnostics-color'?


Michael Collison

Currently it seems the only way is to set showColors to false in the diagnostics engine.


In a cruel twist of API, setShowColor() without an explicit argument will default to disabling color. So you can use

  // Turn color off!

if you want instead until that API gets fixed.