You can map locations in generated C code to locations in some other file, too. Standard C has a pragma for it:
#line <num> "filename"
or, if the filename is the same as the previous pragma, you can omit it from the pragma: #line <num>
This pragma is used to inform the compiler of what information it should use when displaying error messages and such. I think it's meant to be used by the C preprocessor, but the preprocessor isn't required to use it, and other programs aren't prohibited from using it.You might wind up generating a lot of these, but they're really easy to generate as long as you preserve that information all the way through compilation (which I'd assume you'd have to do for LLVM IR regardless).