xref: /llvm-project/clang/test/CodeGen/debug-info-enum-case-val.c (revision 75be0482a2e2a78fae83f1ca604f4ee20d673796)
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2 
3 enum { A = 1 };
func1(int a)4 int func1(int a) {
5   switch(a) {
6   case A: return 10;
7   default: break;
8   }
9   return 0;
10 }
11 // CHECK:       !DICompositeType(tag: DW_TAG_enumeration_type
12 // CHECK-SAME:  elements: [[TEST1_ENUMS:![0-9]*]]
13 // CHECK:       [[TEST1_ENUMS]] = !{[[TEST1_E:![0-9]*]]}
14 // CHECK:       [[TEST1_E]] = !DIEnumerator(name: "A", value: 1)
15 
16 // Test ImplicitCast of switch case enum value
17 enum { B = 2 };
18 typedef unsigned long long __t1;
19 typedef __t1 __t2;
func2(__t2 a)20 int func2(__t2 a) {
21   switch(a) {
22   case B: return 10;
23   default: break;
24   }
25   return 0;
26 }
27 // CHECK:       !DICompositeType(tag: DW_TAG_enumeration_type
28 // CHECK-SAME:  elements: [[TEST2_ENUMS:![0-9]*]]
29 // CHECK:       [[TEST2_ENUMS]] = !{[[TEST2_E:![0-9]*]]}
30 // CHECK:       [[TEST2_E]] = !DIEnumerator(name: "B", value: 2)
31