How create BitcodeModule from ASTUnit and set up this bitcode into the buffer?

I want to generate .bc file, but I wish do it not from c/cpp file, but from ASTUnit in code (ccp file), because I don’t want parse our cpp file twice, I have already made ASTUnit. Finally I have to set up our bitcode into some buffer. I find next: clang::EmitBCAction act(llvmContext.get());, but this method doesn’t work for me, because it’s too high-level, and it doesn’t just create a BitcodeModule, but it immediately uploads it to the disk, and it doesn’t work for me. Does someone know how I can do it?