xref: /llvm-project/clang/test/CodeGen/attr-nodebug.c (revision c79345fb7b149d9c952f8506c9e6c6317a5b4cd8)
1 // RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
2 
3 void t1() __attribute__((nodebug));
4 
5 void t1()
6 {
7   int a = 10;
8   a++;
9 }
10 
11 void t2()
12 {
13   int b = 10;
14   b++;
15 }
16 
17 // With nodebug, IR should have no llvm.dbg.* calls, or !dbg annotations.
18 // CHECK-LABEL: @t1
19 // CHECK-NOT:   dbg
20 // CHECK:       }
21 
22 // Verify those things do occur normally.
23 // CHECK-LABEL: @t2
24 // CHECK:       call{{.*}}llvm.dbg
25 // CHECK:       !dbg
26 // CHECK:       }
27 
28 // We should see a function description for t2 but not t1.
29 // CHECK-NOT: DISubprogram(name: "t1"
30 // CHECK:     DISubprogram(name: "t2"
31 // CHECK-NOT: DISubprogram(name: "t1"
32 
33