summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/debug-info-global.cpp
blob: d0e8cb542d1842bc98a8ebb2183b52bcaaebe1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s

// Multiple references to the same constant should result in only one entry in
// the globals list.

namespace ns {
const int cnst = 42;
}
int f1() {
  return ns::cnst + ns::cnst;
}

// CHECK: !MDCompileUnit(
// CHECK-SAME:           globals: [[GLOBALS:![0-9]*]]

// CHECK: [[GLOBALS]] = !{[[CNST:![0-9]*]]}

// CHECK: [[CNST]] = !MDGlobalVariable(name: "cnst",
// CHECK-SAME:                         scope: [[NS:![0-9]*]]
// CHECK: [[NS]] = !MDNamespace(name: "ns"

OpenPOWER on IntegriCloud