xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/enum-declaration-uniqueness.cpp (revision 2fefc042ce8faf8516ae66e1529d87c7130094a1)
1*2fefc042SPavel Labath // REQUIRES: lld
2*2fefc042SPavel Labath //
3*2fefc042SPavel Labath // RUN: %clangxx --target=x86_64-pc-linux -g -c -o %t_a.o %s -DFILE_A
4*2fefc042SPavel Labath // RUN: %clangxx --target=x86_64-pc-linux -g -c -o %t_b.o %s -DFILE_B
5*2fefc042SPavel Labath // RUN: ld.lld -o %t %t_a.o %t_b.o
6*2fefc042SPavel Labath // RUN: %lldb %t \
7*2fefc042SPavel Labath // RUN:   -o "target variable my_enum my_enum_ref" -o "image dump ast" \
8*2fefc042SPavel Labath // RUN:   -o exit | FileCheck %s
9*2fefc042SPavel Labath 
10*2fefc042SPavel Labath 
11*2fefc042SPavel Labath // CHECK: (lldb) target variable
12*2fefc042SPavel Labath // CHECK: (MyEnum) my_enum = MyEnum_A
13*2fefc042SPavel Labath // CHECK: (MyEnum &) my_enum_ref =
14*2fefc042SPavel Labath // CHECK-SAME: &::my_enum_ref = MyEnum_A
15*2fefc042SPavel Labath 
16*2fefc042SPavel Labath // CHECK: (lldb) image dump ast
17*2fefc042SPavel Labath // CHECK: EnumDecl {{.*}} MyEnum
18*2fefc042SPavel Labath // CHECK-NEXT: EnumConstantDecl {{.*}} MyEnum_A 'MyEnum'
19*2fefc042SPavel Labath // CHECK-NOT: MyEnum
20*2fefc042SPavel Labath 
21*2fefc042SPavel Labath enum MyEnum : int;
22*2fefc042SPavel Labath 
23*2fefc042SPavel Labath extern MyEnum my_enum;
24*2fefc042SPavel Labath 
25*2fefc042SPavel Labath #ifdef FILE_A
26*2fefc042SPavel Labath enum MyEnum : int { MyEnum_A };
27*2fefc042SPavel Labath 
28*2fefc042SPavel Labath MyEnum my_enum = MyEnum_A;
29*2fefc042SPavel Labath #endif
30*2fefc042SPavel Labath #ifdef FILE_B
31*2fefc042SPavel Labath MyEnum &my_enum_ref = my_enum;
32*2fefc042SPavel Labath #endif
33