1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj -O0 < %s > %t 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump %t | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; CHECK: [[FILEID:[0-9]+]]]{{.*}}list0.h 5*9880d681SAndroid Build Coastguard Worker; CHECK: [[FILEID]] 0 1 0 0 is_stmt{{$}} 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker; IR generated from clang -g -emit-llvm with the following source: 8*9880d681SAndroid Build Coastguard Worker; list0.h: 9*9880d681SAndroid Build Coastguard Worker; int foo (int x) { 10*9880d681SAndroid Build Coastguard Worker; return ++x; 11*9880d681SAndroid Build Coastguard Worker; } 12*9880d681SAndroid Build Coastguard Worker; list0.c: 13*9880d681SAndroid Build Coastguard Worker; #include "list0.h" 14*9880d681SAndroid Build Coastguard Worker; int main() { 15*9880d681SAndroid Build Coastguard Worker; } 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i32 %x) #0 !dbg !4 { 18*9880d681SAndroid Build Coastguard Workerentry: 19*9880d681SAndroid Build Coastguard Worker %x.addr = alloca i32, align 4 20*9880d681SAndroid Build Coastguard Worker store i32 %x, i32* %x.addr, align 4 21*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !14, metadata !DIExpression()), !dbg !15 22*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %x.addr, align 4, !dbg !16 23*9880d681SAndroid Build Coastguard Worker %inc = add nsw i32 %0, 1, !dbg !16 24*9880d681SAndroid Build Coastguard Worker store i32 %inc, i32* %x.addr, align 4, !dbg !16 25*9880d681SAndroid Build Coastguard Worker ret i32 %inc, !dbg !16 26*9880d681SAndroid Build Coastguard Worker} 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 !dbg !10 { 31*9880d681SAndroid Build Coastguard Workerentry: 32*9880d681SAndroid Build Coastguard Worker ret i32 0, !dbg !17 33*9880d681SAndroid Build Coastguard Worker} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } 36*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 39*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!19} 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 42*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "list0.c", directory: "/usr/local/google/home/blaikie/dev/scratch") 43*9880d681SAndroid Build Coastguard Worker!2 = !{} 44*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !5, scope: !6, type: !7, variables: !2) 45*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "./list0.h", directory: "/usr/local/google/home/blaikie/dev/scratch") 46*9880d681SAndroid Build Coastguard Worker!6 = !DIFile(filename: "./list0.h", directory: "/usr/local/google/home/blaikie/dev/scratch") 47*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8) 48*9880d681SAndroid Build Coastguard Worker!8 = !{!9, !9} 49*9880d681SAndroid Build Coastguard Worker!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 50*9880d681SAndroid Build Coastguard Worker!10 = distinct !DISubprogram(name: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !11, type: !12, variables: !2) 51*9880d681SAndroid Build Coastguard Worker!11 = !DIFile(filename: "list0.c", directory: "/usr/local/google/home/blaikie/dev/scratch") 52*9880d681SAndroid Build Coastguard Worker!12 = !DISubroutineType(types: !13) 53*9880d681SAndroid Build Coastguard Worker!13 = !{!9} 54*9880d681SAndroid Build Coastguard Worker!14 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !4, file: !6, type: !9) 55*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 1, scope: !4) 56*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 2, scope: !4) 57*9880d681SAndroid Build Coastguard Worker!17 = !DILocation(line: 3, scope: !18) 58*9880d681SAndroid Build Coastguard Worker!18 = !DILexicalBlockFile(discriminator: 0, file: !11, scope: !10) 59*9880d681SAndroid Build Coastguard Worker!19 = !{i32 1, !"Debug Info Version", i32 3} 60