summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/debug-info-scope-file.c
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-14 00:29:00 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-14 00:29:00 +0000
commitaabde05da1d5ca86f23a7fc8f7e9da4dea7ae205 (patch)
tree1282d6f005511f3298832461db6fb22362098ab3 /clang/test/CodeGen/debug-info-scope-file.c
parente24614f74e85e3b4294230888c49a2db0cb0cde6 (diff)
downloadbcm5719-llvm-aabde05da1d5ca86f23a7fc8f7e9da4dea7ae205.tar.gz
bcm5719-llvm-aabde05da1d5ca86f23a7fc8f7e9da4dea7ae205.zip
DebugInfo: Avoid creating DILexicalScopeFiles when the filename in the current scope has not changed.
This looks like the right way for this check to work, but there is another semi-obvious bug, I would think: why is CurLoc not zero'd out between functions? The possibility for it to bleed between them seems problematic. (& indeed I caused tests to fail when I fixed this a different way, by setting CurLoc to SourceLocation() and the end of EmitFunctionEnd... ) The changes to debug-info-blocks.m are due to a mismatch between the source manager's file naming and CGDebugInfo's default handling when no -main-file-name is specified. This actually reveals somewhat of a bug in the debug info when using source files from standard in, too. See the comment in CGDebugInfo::CreateCompileUnit for more details. llvm-svn: 208742
Diffstat (limited to 'clang/test/CodeGen/debug-info-scope-file.c')
-rw-r--r--clang/test/CodeGen/debug-info-scope-file.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/debug-info-scope-file.c b/clang/test/CodeGen/debug-info-scope-file.c
new file mode 100644
index 00000000000..3479ade7a32
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-scope-file.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s
+
+// Check that, just because we emitted a function from a different file doesn't
+// mean we insert a file-change inside the next function.
+
+// CHECK: ret void, !dbg [[F1_LINE:![0-9]*]]
+// CHECK: ret void, !dbg [[F2_LINE:![0-9]*]]
+// CHECK: [[F1:![0-9]*]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [f1]
+// CHECK: [[F2:![0-9]*]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [f2]
+// CHECK: [[F1_LINE]] = {{.*}}, metadata [[F1]], null}
+// CHECK: [[F2_LINE]] = {{.*}}, metadata [[F2]], null}
+
+void f1() {
+}
+
+# 2 "foo.c"
+
+void f2() {
+}
+
OpenPOWER on IntegriCloud