blob: 5fc61c7c4d459b174ed7ae5c87bbf73a65faf5f0 [file] [log] [blame]
David Blaikiebb113912014-04-05 07:23:17 +00001// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s
2
3// Multiple references to the same constant should result in only one entry in
4// the globals list.
5
David Blaikie506a7452014-04-05 07:46:57 +00006namespace ns {
David Blaikiebb113912014-04-05 07:23:17 +00007const int cnst = 42;
David Blaikie506a7452014-04-05 07:46:57 +00008}
David Blaikiebb113912014-04-05 07:23:17 +00009int f1() {
David Blaikie506a7452014-04-05 07:46:57 +000010 return ns::cnst + ns::cnst;
David Blaikiebb113912014-04-05 07:23:17 +000011}
12
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000013// CHECK: !"0x11\00{{.*}}"{{.*}}, [[GLOBALS:![0-9]*]], {{![0-9]*}}} ; [ DW_TAG_compile_unit ]
David Blaikiebb113912014-04-05 07:23:17 +000014
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000015// CHECK: [[GLOBALS]] = !{[[CNST:![0-9]*]]}
David Blaikiebb113912014-04-05 07:23:17 +000016
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000017// CHECK: [[CNST]] = !{!"0x34\00cnst\00{{.*}}", [[NS:![0-9]*]], {{[^,]+, [^,]+, [^,]+, [^,]+}}} ; [ DW_TAG_variable ] [cnst]
David Blaikie506a7452014-04-05 07:46:57 +000018// CHECK: [[NS]] = {{.*}}; [ DW_TAG_namespace ] [ns]
19