brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · e4278d5 Raw
73 lines · plain
1; Test that coverage instrumentation does not lose debug location.2 3; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=2 -S | FileCheck %s4 5; C++ source:6; 1: void foo(int *a) {7; 2:     if (a)8; 3:         *a = 0;9; 4: }10; clang++ if.cc -O3 -g -S -emit-llvm11; and add sanitize_address to @_Z3fooPi12 13 14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"15target triple = "x86_64-unknown-linux-gnu"16 17; Check that __sanitizer_cov call has !dgb pointing to the beginning18; of appropriate basic blocks.19; CHECK-LABEL:_Z3fooPi20; CHECK: call void @__sanitizer_cov{{.*}}(ptr{{.*}}) #{{.*}}, !dbg [[A:!.*]]21; CHECK: call void @__sanitizer_cov{{.*}}(ptr{{.*}}) #{{.*}}, !dbg [[B:!.*]]22; CHECK: ret void23; CHECK: [[A]] = !DILocation(line: 1, scope: !{{.*}})24; CHECK: [[B]] = !DILocation(line: 3, column: 5, scope: !{{.*}})25 26define void @_Z3fooPi(ptr %a) #0 !dbg !4 {27entry:28  tail call void @llvm.dbg.value(metadata ptr %a, i64 0, metadata !11, metadata !DIExpression()), !dbg !1529  %tobool = icmp eq ptr %a, null, !dbg !1630  br i1 %tobool, label %if.end, label %if.then, !dbg !1631 32if.then:                                          ; preds = %entry33  store i32 0, ptr %a, align 4, !dbg !18, !tbaa !1934  br label %if.end, !dbg !1835 36if.end:                                           ; preds = %entry, %if.then37  ret void, !dbg !2338}39 40; Function Attrs: nounwind readnone41declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #142 43attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" sanitize_address}44attributes #1 = { nounwind readnone }45 46!llvm.dbg.cu = !{!0}47!llvm.module.flags = !{!12, !13}48!llvm.ident = !{!14}49 50!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (217079)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)51!1 = !DIFile(filename: "if.cc", directory: "FOO")52!2 = !{}53!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooPi", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !10)54!5 = !DIFile(filename: "if.cc", directory: "FOO")55!6 = !DISubroutineType(types: !7)56!7 = !{null, !8}57!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)58!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)59!10 = !{!11}60!11 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8)61!12 = !{i32 2, !"Dwarf Version", i32 4}62!13 = !{i32 2, !"Debug Info Version", i32 3}63!14 = !{!"clang version 3.6.0 (217079)"}64!15 = !DILocation(line: 1, column: 15, scope: !4)65!16 = !DILocation(line: 2, column: 7, scope: !17)66!17 = distinct !DILexicalBlock(line: 2, column: 7, file: !1, scope: !4)67!18 = !DILocation(line: 3, column: 5, scope: !17)68!19 = !{!20, !20, i64 0}69!20 = !{!"int", !21, i64 0}70!21 = !{!"omnipotent char", !22, i64 0}71!22 = !{!"Simple C/C++ TBAA"}72!23 = !DILocation(line: 4, column: 1, scope: !4)73