summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/debug-info-global-constant.c
blob: 8cb7f44ff3f040772216c6064fce8315fc865e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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]] = !DIGlobalVariableExpression(var: ![[VAR:.*]], expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value))
// CHECK: ![[VAR]] = distinct !DIGlobalVariable(name: "i",
// CHECK: !DICompileUnit({{.*}}globals: ![[GLOBALS:[0-9]+]])
// CHECK: ![[GLOBALS]] = !{![[I]]}
static const int i = 1;

void g(const int *, int);
void f() {
  g(&i, i);
}