Dump AST without control codes

Hello,

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'?

Regards,

Michael Collison

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

  SourceManager->getDiagnostics().setShowColor(false);
  decl->dump();

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

  // Turn color off!
  SourceManager->getDiagnostics().setShowColor();
  decl->dump();

if you want instead until that API gets fixed.

Thanks,

Stephen.