2014-04-05 15:23:17 +08:00
|
|
|
// 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.
|
|
|
|
|
2014-04-05 15:46:57 +08:00
|
|
|
namespace ns {
|
2014-04-05 15:23:17 +08:00
|
|
|
const int cnst = 42;
|
2014-04-05 15:46:57 +08:00
|
|
|
}
|
2014-04-05 15:23:17 +08:00
|
|
|
int f1() {
|
2014-04-05 15:46:57 +08:00
|
|
|
return ns::cnst + ns::cnst;
|
2014-04-05 15:23:17 +08:00
|
|
|
}
|
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDCompileUnit(
|
|
|
|
// CHECK-SAME: globals: [[GLOBALS:![0-9]*]]
|
2014-04-05 15:23:17 +08:00
|
|
|
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[GLOBALS]] = !{[[CNST:![0-9]*]]}
|
2014-04-05 15:23:17 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[CNST]] = !MDGlobalVariable(name: "cnst",
|
|
|
|
// CHECK-SAME: scope: [[NS:![0-9]*]]
|
|
|
|
// CHECK: [[NS]] = !MDNamespace(name: "ns"
|
2014-04-05 15:46:57 +08:00
|
|
|
|