blob: d75ce69d4c6c026a263b287c1f8cb3e68dbef5f3 [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 Smithf04be1f2015-03-03 17:25:55 +000024// CHECK: [[FILE:.*]] = !MDFile(filename: "{{.*}}debug-info-anon-union-vars.cpp",
25// CHECK: !MDGlobalVariable(name: "c",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
26// CHECK: !MDGlobalVariable(name: "d",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
27// CHECK: !MDGlobalVariable(name: "a",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
28// CHECK: !MDGlobalVariable(name: "b",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true