Eric Christopher | cab9fae | 2014-04-10 05:20:00 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -gdwarf-4 -triple x86_64-linux-gnu %s -o - | FileCheck %s |
| 2 | |
| 3 | // Make sure that we emit a global variable for each of the members of the |
| 4 | // anonymous union. |
| 5 | |
| 6 | static union { |
| 7 | int c; |
| 8 | int d; |
| 9 | union { |
| 10 | int a; |
| 11 | }; |
| 12 | struct { |
| 13 | int b; |
| 14 | }; |
| 15 | }; |
| 16 | |
| 17 | int test_it() { |
| 18 | c = 1; |
| 19 | d = 2; |
| 20 | a = 4; |
| 21 | return (c == 1); |
| 22 | } |
| 23 | |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 24 | // CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-info-anon-union-vars.cpp", |
| 25 | // CHECK: !DIGlobalVariable(name: "c",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true |
| 26 | // CHECK: !DIGlobalVariable(name: "d",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true |
| 27 | // CHECK: !DIGlobalVariable(name: "a",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true |
| 28 | // CHECK: !DIGlobalVariable(name: "b",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true |