xref: /llvm-project/clang/test/CodeGen/debug-info-no-inline-line-tables.c (revision 39db5e1ed87363a9ffea81e53520b542201b3262)
1 // RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited \
2 // RUN:   -gno-inline-line-tables -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang -gno-inline-line-tables -S -emit-llvm -o - %s | FileCheck %s \
4 // RUN:   -check-prefix=INLINE-FLAG
5 // RUN: %clang -S -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-FLAG
6 
7 int x;
f(void)8 __attribute((always_inline)) void f(void) {
9   x += 1;
10 }
main(void)11 int main(void) {
12   f();
13   x += 2;
14   return x;
15 }
16 
17 // Check that clang emits the location of the call site and not the inlined
18 // function in the debug info.
19 // CHECK: define dso_local i32 @main()
20 // CHECK: %{{.+}} = load i32, ptr @x, align 4, !dbg [[DbgLoc:![0-9]+]]
21 
22 // Check that the no-inline-line-tables attribute is added.
23 // CHECK: attributes #0 = {{.*}}"no-inline-line-tables"{{.*}}
24 // CHECK: attributes #1 = {{.*}}"no-inline-line-tables"{{.*}}
25 
26 // CHECK: [[DbgLoc]] = !DILocation(line: 12,
27 // CHECK-NOT:  inlinedAt:
28 
29 // INLINE-FLAG: attributes #0 = {{.*}}"no-inline-line-tables"{{.*}}
30 // INLINE-FLAG: attributes #1 = {{.*}}"no-inline-line-tables"{{.*}}
31 // NO-FLAG-NOT: "no-inline-line-tables"
32