]> granicus.if.org Git - clang/commit
[Clang] Use -main-file-name for source filename if not set
authorTeresa Johnson <tejohnson@google.com>
Mon, 30 Sep 2019 15:05:35 +0000 (15:05 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 30 Sep 2019 15:05:35 +0000 (15:05 +0000)
commit3da9ca444f1095d12681e86b15160e6e1fb89d64
treef1e3bbae49736deeaa0dd6496189adc32159c024
parentbc17e9d2f16c434eb1e8d6800e0d439bbfd1ed0c
[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
information.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373217 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/CC1Options.td
lib/CodeGen/ModuleBuilder.cpp
test/Frontend/stdin-input.c [new file with mode: 0644]