blob: cfc7bc8fbfe01c49dfab8c76efb60d95239b9b73 [file] [log] [blame]
Eric Christophercab9fae2014-04-10 05:20:00 +00001// 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
6static union {
7 int c;
8 int d;
9 union {
10 int a;
11 };
12 struct {
13 int b;
14 };
15};
16
17int test_it() {
18 c = 1;
19 d = 2;
20 a = 4;
21 return (c == 1);
22}
23
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000024// 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