[LLVMdev] get file name

Duncan Sands baldrick at free.fr
Wed May 18 00:34:21 PDT 2011


Hi George,

>    I am trying to get the name (hello) of the c file (e.g., hello.c)  that I am
> processing.
> When I use Module.getModuleIdentifier, I get <stdin> as the
> module id. It seems I am doing something wrong. Any help
> is greatly appreciated. Thanks.

the LLVM IR does not contain the name of the file in general.  That's normal
since (1) bitcode need not come from compiling a file; and (2) the bitcode
could be the result of compiling several files and linking their bitcode
together (so corresponds to several files).  Anyway, you should use debug info
to get this information (which will only work if the bitcode contains debug
info).

Ciao, Duncan.



More information about the llvm-dev mailing list