Get the filename on which a pass is running?


I was wondering how can I get the name of the bitcode file on which I am running the pass. I am making my pass as a loadable module. And if I run my pass like this -

opt -S -loops -load /home/arnie/llvm-clang/llvm/Release+Asserts/lib/ -xyz <b.bc> b1.bc

I want to get b.bc in the pass.

Thank you;

Hi Arnamoy,

Since you're piping the bitcode into opt, there's no way of getting the file name because opt just reads from STDIN.

Would it perhaps make more sense to ensure that your bitcode has debug information embedded (!dbg metadata) and use that to store a file name?