xref: /aosp_15_r20/external/llvm/test/DebugInfo/Generic/global.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump %t | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Also test that the null streamer doesn't crash with debug info.
7*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=null < %s
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; generated from the following source compiled to bitcode with clang -g -O1
10*9880d681SAndroid Build Coastguard Worker; static int i;
11*9880d681SAndroid Build Coastguard Worker; int main() {
12*9880d681SAndroid Build Coastguard Worker;   (void)&i;
13*9880d681SAndroid Build Coastguard Worker; }
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker; CHECK: debug_info contents
16*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_variable
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone uwtable
19*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 !dbg !4 {
20*9880d681SAndroid Build Coastguard Workerentry:
21*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !12
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
27*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!11, !13}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !9, imports: !2)
30*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "global.cpp", directory: "/tmp")
31*9880d681SAndroid Build Coastguard Worker!2 = !{}
32*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !2)
33*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "global.cpp", directory: "/tmp")
34*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
35*9880d681SAndroid Build Coastguard Worker!7 = !{!8}
36*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
37*9880d681SAndroid Build Coastguard Worker!9 = !{!10}
38*9880d681SAndroid Build Coastguard Worker!10 = !DIGlobalVariable(name: "i", linkageName: "_ZL1i", line: 1, isLocal: true, isDefinition: true, scope: null, file: !5, type: !8)
39*9880d681SAndroid Build Coastguard Worker!11 = !{i32 2, !"Dwarf Version", i32 3}
40*9880d681SAndroid Build Coastguard Worker!12 = !DILocation(line: 4, scope: !4)
41*9880d681SAndroid Build Coastguard Worker!13 = !{i32 1, !"Debug Info Version", i32 3}
42