debug-info-producer-with-flags.ll
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix LINUX
; RUN: llc -mtriple=x86_64-apple-macosx %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix DARWIN
;
; Test the DW_AT_producer DWARF attribute.
; When producer and flags are both given in DIComileUnit, set DW_AT_producer
; as two values combined.
;
; The test splits into two parts, this is LLVM part. The frontend part can be
; found at llvm/tools/clang/test/Driver/debug-options.c.
;
; Generated and reduced from:
; clang++ -g -grecord-gcc-switches test.cc -S -llvm-emit -o -
;
; test.cc:
; int main() {
; return 0;
; }
; LINUX: DW_AT_producer{{.*}}("clang++ -g -grecord-gcc-switches test.cc -S -emit-llvm -o -")
; DARWIN: DW_AT_producer{{.*}}("clang++")
; DARWIN: DW_AT_APPLE_flags{{.*}}("-g -grecord-gcc-switches test.cc -S -emit-llvm -o -")
target triple = "x86_64-unknown-linux-gnu"
define i32 @main() !dbg !6 {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval, align 4
ret i32 0, !dbg !10
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!llvm.ident = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang++", isOptimized: false, flags: "-g -grecord-gcc-switches test.cc -S -emit-llvm -o -", runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "test.cc", directory: "d")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{!"clang"}
!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !7, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!7 = !DISubroutineType(types: !8)
!8 = !{!9}
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!10 = !DILocation(line: 5, column: 3, scope: !6)