Clang Project

clang_source_code/test/CodeGenCXX/dbg-info-all-calls-described.cpp
1// Test that call site debug info is (un)supported in various configurations.
2
3// Supported: DWARF5, -O1, standalone DI
4// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \
5// RUN:   -O1 -disable-llvm-passes \
6// RUN:   -debug-info-kind=standalone -dwarf-version=5 \
7// RUN: | FileCheck %s -check-prefix=HAS-ATTR \
8// RUN:     -implicit-check-not=DISubprogram -implicit-check-not=DIFlagAllCallsDescribed
9
10// Supported: DWARF4 + LLDB tuning, -O1, limited DI
11// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \
12// RUN:   -O1 -disable-llvm-passes \
13// RUN:   -debugger-tuning=lldb \
14// RUN:   -debug-info-kind=standalone -dwarf-version=4 \
15// RUN: | FileCheck %s -check-prefix=HAS-ATTR \
16// RUN:     -implicit-check-not=DISubprogram -implicit-check-not=DIFlagAllCallsDescribed
17
18// Supported: DWARF4 + LLDB tuning, -O1, line-tables only DI
19// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \
20// RUN:   -O1 -disable-llvm-passes \
21// RUN:   -debugger-tuning=lldb \
22// RUN:   -debug-info-kind=line-tables-only -dwarf-version=4 \
23// RUN: | FileCheck %s -check-prefix=LINE-TABLES-ONLY
24
25// Unsupported: -O0
26// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \
27// RUN:   -O0 \
28// RUN:   -debug-info-kind=standalone -dwarf-version=5 \
29// RUN: | FileCheck %s -check-prefix=NO-ATTR
30
31// Unsupported: DWARF4
32// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \
33// RUN:   -O1 -disable-llvm-passes \
34// RUN:   -debug-info-kind=standalone -dwarf-version=4 \
35// RUN: | FileCheck %s -check-prefix=NO-ATTR
36
37// NO-ATTR-NOT: FlagAllCallsDescribed
38
39// HAS-ATTR-DAG: DISubprogram(name: "declaration2", {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition
40// HAS-ATTR-DAG: DISubprogram(name: "struct1", {{.*}}, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
41// HAS-ATTR-DAG: DISubprogram(name: "struct1", {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition
42// HAS-ATTR-DAG: DISubprogram(name: "method1", {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition
43// HAS-ATTR-DAG: DISubprogram(name: "force_irgen", {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition
44
45// LINE-TABLES-ONLY: DISubprogram(name: "force_irgen", {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition
46
47void declaration1();
48
49void declaration2();
50
51void declaration2() {}
52
53struct struct1 {
54  struct1() {}
55  void method1() {}
56};
57
58void __attribute__((optnone)) force_irgen() {
59  declaration1();
60  struct1().method1();
61}
62