Emit assembly to memory buffer with clang

Hello all,

I'm trying to use clang to emit assembly to a buffer.
I'm using EmitAssemblyAction and have troubles figuring out a way to provide custom output stream or memory buffer to emit the assembly into (seems like remapping files to memory buffers with addRemappedFile works only with input files).
Is there a way to set a custom output stream or remap output file while still using CompilerInstance/CodeGenAction? Or should I use something else?