Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 2 | |
| 3 | // Multiple references to the same constant should result in only one entry in |
| 4 | // the globals list. |
| 5 | |
David Blaikie | 506a745 | 2014-04-05 07:46:57 +0000 | [diff] [blame] | 6 | namespace ns { |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 7 | const int cnst = 42; |
David Blaikie | 506a745 | 2014-04-05 07:46:57 +0000 | [diff] [blame] | 8 | } |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 9 | int f1() { |
David Blaikie | 506a745 | 2014-04-05 07:46:57 +0000 | [diff] [blame] | 10 | return ns::cnst + ns::cnst; |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 11 | } |
| 12 | |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 13 | // CHECK: !DICompileUnit( |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 14 | // CHECK-SAME: globals: [[GLOBALS:![0-9]*]] |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 15 | |
Duncan P. N. Exon Smith | b3a6669 | 2014-12-15 19:10:08 +0000 | [diff] [blame] | 16 | // CHECK: [[GLOBALS]] = !{[[CNST:![0-9]*]]} |
David Blaikie | bb11391 | 2014-04-05 07:23:17 +0000 | [diff] [blame] | 17 | |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 18 | // CHECK: [[CNST]] = !DIGlobalVariable(name: "cnst", |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 19 | // CHECK-SAME: scope: [[NS:![0-9]*]] |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 20 | // CHECK: [[NS]] = !DINamespace(name: "ns" |
David Blaikie | 506a745 | 2014-04-05 07:46:57 +0000 | [diff] [blame] | 21 | |