[Clang] Use -main-file-name for source filename if not set

Authored by tejohnson on Sep 30 2019, 8:05 AM.


[Clang] Use -main-file-name for source filename if not set

-main-file-name is currently used to set the source name used in debug

If the source filename is "-" and -main-file-name is set, then use the
filename also for source_filename and ModuleID of the output.

The argument is generally used outside the internal clang calls when
running clang in a wrapper like icecc which gives the source via stdin
but still wants to get a object file with the original source filename
both in debug info and IR code.

Patch by: the_jk (Joel Klinghed)

Differential Revision: https://reviews.llvm.org/D67592

llvm-svn: 373217