summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2019-09-30 15:05:35 +0000
committerTeresa Johnson <tejohnson@google.com>2019-09-30 15:05:35 +0000
commit57dbfe194cb53b25246a40e8a73e5c77cc804619 (patch)
treef9bee83577707fa33ef90a7a1e0ee2d5edc3088f /clang/test/Frontend
parent14945186c28ee41162eedc7fa89e04548f2bda6d (diff)
downloadbcm5719-llvm-57dbfe194cb53b25246a40e8a73e5c77cc804619.tar.gz
bcm5719-llvm-57dbfe194cb53b25246a40e8a73e5c77cc804619.zip
[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 llvm-svn: 373217
Diffstat (limited to 'clang/test/Frontend')
-rw-r--r--clang/test/Frontend/stdin-input.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Frontend/stdin-input.c b/clang/test/Frontend/stdin-input.c
new file mode 100644
index 00000000000..334c1676025
--- /dev/null
+++ b/clang/test/Frontend/stdin-input.c
@@ -0,0 +1,7 @@
+// RUN: cat %s | %clang -emit-llvm -g -S \
+// RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s
+// CHECK: ; ModuleID = 'test/foo.c'
+// CHECK: source_filename = "test/foo.c"
+// CHECK: !1 = !DIFile(filename: "test/foo.c"
+
+int main() {}
OpenPOWER on IntegriCloud