1 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=line-tables-only -debug-info-macro %s -o - "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s |
2 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=line-directives-only -debug-info-macro %s -o - "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s |
3 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -debug-info-macro %s -o - "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s |
4 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -debug-info-macro %s -o - "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s |
5 | // RUN: %clang_cc1 -emit-llvm -debug-info-macro %s -o - "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=NO_MACRO %s |
6 | |
7 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -debug-info-macro %S/Inputs/debug-info-macro.h -emit-pch -o %t.pch -DC3 |
8 | // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -debug-info-macro %s -o - -include-pch %t.pch "-DC1(x)=( x + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,PCH %s |
9 | |
10 | // This test checks that macro Debug info is correctly generated. |
11 | |
12 | // TODO: Check for an following entry once support macros defined in pch files. |
13 | // -PCH: !DIMacro(type: DW_MACINFO_define, name: "C3", value: "1")> |
14 | |
15 | #line 15 |
16 | /*Line 15*/ #define D1 1 |
17 | /*Line 16*/ #include "Inputs/debug-info-macro.h" |
18 | /*Line 17*/ #undef D1 |
19 | /*Line 18*/ #define D2 2 |
20 | /*Line 19*/ #include "Inputs/debug-info-macro.h" |
21 | /*Line 20*/ #undef D2 |
22 | |
23 | // NO_MACRO-NOT: macros |
24 | // NO_MACRO-NOT: DIMacro |
25 | // NO_MACRO-NOT: DIMacroFile |
26 | |
27 | // CHECK: !DICompileUnit({{.*}} macros: [[Macros:![0-9]+]] |
28 | // CHECK: [[EmptyMD:![0-9]+]] = !{} |
29 | |
30 | // NO_PCH: [[Macros]] = !{[[MainMacroFile:![0-9]+]], [[BuiltinMacro:![0-9]+]], {{.*}}, [[DefineC1:![0-9]+]], [[DefineA:![0-9]+]], [[UndefC1:![0-9]+]]} |
31 | // PCH: [[Macros]] = !{[[MainMacroFile:![0-9]+]], [[DefineC1:![0-9]+]], [[DefineA:![0-9]+]], [[UndefC1:![0-9]+]]} |
32 | |
33 | // CHECK: [[MainMacroFile]] = !DIMacroFile(file: [[MainFile:![0-9]+]], nodes: [[N1:![0-9]+]]) |
34 | // CHECK: [[MainFile]] = !DIFile(filename: "{{.*}}debug-info-macro.c" |
35 | // CHECK: [[N1]] = !{[[CommandLineInclude:![0-9]+]], [[DefineD1:![0-9]+]], [[FileInclude1:![0-9]+]], [[UndefD1:![0-9]+]], [[DefineD2:![0-9]+]], [[FileInclude2:![0-9]+]], [[UndefD2:![0-9]+]]} |
36 | |
37 | // CHECK: [[CommandLineInclude]] = !DIMacroFile(file: [[HeaderFile:![0-9]+]], nodes: [[N2:![0-9]+]]) |
38 | // CHECK: [[HeaderFile]] = !DIFile(filename: "{{.*}}debug-info-macro.h" |
39 | // CHECK: [[N2]] = !{[[UndefA:![0-9]+]]} |
40 | // CHECK: [[UndefA]] = !DIMacro(type: DW_MACINFO_undef, line: 11, name: "A") |
41 | |
42 | // CHECK: [[DefineD1]] = !DIMacro(type: DW_MACINFO_define, line: 15, name: "D1", value: "1") |
43 | // CHECK: [[FileInclude1]] = !DIMacroFile(line: 16, file: [[HeaderFile]], nodes: [[N3:![0-9]+]]) |
44 | // CHECK: [[N3]] = !{[[DefineAx:![0-9]+]], [[UndefA]]} |
45 | // CHECK: [[DefineAx]] = !DIMacro(type: DW_MACINFO_define, line: 3, name: "A(x,y,z)", value: "(x)") |
46 | // CHECK: [[UndefD1]] = !DIMacro(type: DW_MACINFO_undef, line: 17, name: "D1") |
47 | |
48 | // CHECK: [[DefineD2]] = !DIMacro(type: DW_MACINFO_define, line: 18, name: "D2", value: "2") |
49 | // CHECK: [[FileInclude2]] = !DIMacroFile(line: 19, file: [[HeaderFile]], nodes: [[N4:![0-9]+]]) |
50 | // CHECK: [[N4]] = !{[[DefineAy:![0-9]+]], [[UndefA]]} |
51 | // CHECK: [[DefineAy]] = !DIMacro(type: DW_MACINFO_define, line: 7, name: "A(x,y,z)", value: "(y)") |
52 | // CHECK: [[UndefD2]] = !DIMacro(type: DW_MACINFO_undef, line: 20, name: "D2") |
53 | |
54 | // NO_PCH: [[BuiltinMacro]] = !DIMacro(type: DW_MACINFO_define, name: "__llvm__", value: "1") |
55 | |
56 | // CHECK: [[DefineC1]] = !DIMacro(type: DW_MACINFO_define, name: "C1(x)", value: "( x + 5 )") |
57 | // CHECK: [[DefineA]] = !DIMacro(type: DW_MACINFO_define, name: "A", value: "1") |
58 | // CHECK: [[UndefC1]] = !DIMacro(type: DW_MACINFO_undef, name: "C1") |
59 | |