diff options
| author | Adrian Prantl <aprantl@apple.com> | 2016-11-09 00:42:03 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2016-11-09 00:42:03 +0000 |
| commit | 338ef7a82c720b73faf64b31605aa2709b0cf14a (patch) | |
| tree | bb74c6b600ab7fabebdbe3b64300353895883b4a /clang/test | |
| parent | a50bc7fddb321214e16babe0a4e1964422c81454 (diff) | |
| download | bcm5719-llvm-338ef7a82c720b73faf64b31605aa2709b0cf14a.tar.gz bcm5719-llvm-338ef7a82c720b73faf64b31605aa2709b0cf14a.zip | |
Emit debug info for global constants whose address is taken exactly once.
Add a check to the DeclCache before emitting debug info for a
GlobalVariable a second time and just attach the previsously created one to it.
<rdar://problem/26721101>
llvm-svn: 286322
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/debug-info-global-constant.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CodeGen/debug-info-global-constant.c b/clang/test/CodeGen/debug-info-global-constant.c new file mode 100644 index 00000000000..f214fdcd113 --- /dev/null +++ b/clang/test/CodeGen/debug-info-global-constant.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone \ +// RUN: -triple %itanium_abi_triple %s -o - | FileCheck %s + +// Debug info for a global constant whose address is taken should be emitted +// exactly once. + +// CHECK: @i = internal constant i32 1, align 4, !dbg ![[I:[0-9]+]] +// CHECK: ![[I]] = distinct !DIGlobalVariable(name: "i", +// CHECK-SAME: expr: ![[EXPR:[0-9]+]] +// CHECK: !DICompileUnit({{.*}}globals: ![[GLOBALS:[0-9]+]]) +// CHECK: ![[GLOBALS]] = !{![[I]]} +// CHECK: ![[EXPR]] = !DIExpression(DW_OP_constu, 1, DW_OP_stack_value) +static const int i = 1; + +void g(const int *, int); +void f() { + g(&i, i); +} |

