2013-04-08 18:41:23 +00:00
; RUN: llvm-link %s %p/DbgDeclare2.ll -o %t.bc
; RUN: llvm-dis < %t.bc | FileCheck %s
; Test if metadata in dbg.declare is mapped properly or not.
; rdar://13089880
; CHECK: define i32 @main(i32 %argc, i8** %argv)
2015-01-18 16:17:27 +00:00
; CHECK: call void @llvm.dbg.declare(metadata i32* %argc.addr, metadata !{{[0-9]+}}, metadata {{.*}})
; CHECK: call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !{{[0-9]+}}, metadata {{.*}})
2013-04-08 18:41:23 +00:00
; CHECK: define void @test(i32 %argc, i8** %argv)
2015-01-18 16:17:27 +00:00
; CHECK: call void @llvm.dbg.declare(metadata i32* %argc.addr, metadata !{{[0-9]+}}, metadata {{.*}})
; CHECK: call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !{{[0-9]+}}, metadata {{.*}})
; CHECK: call void @llvm.dbg.declare(metadata i32* %i, metadata !{{[0-9]+}}, metadata {{.*}})
2013-04-08 18:41:23 +00:00
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"
2015-12-30 11:46:15 +00:00
define i32 @main ( i32 %argc , i8 * * %argv ) uwtable ssp !dbg !5 {
2013-04-08 18:41:23 +00:00
entry:
%retval = alloca i32 , align 4
%argc.addr = alloca i32 , align 4
%argv.addr = alloca i8 * * , align 8
store i32 0 , i32 * %retval
store i32 %argc , i32 * %argc.addr , align 4
2015-05-27 18:44:32 +00:00
call void @llvm.dbg.declare ( metadata i32 * %argc.addr , metadata !14 , metadata !DIExpression ( ) ) , !dbg !15
2013-04-08 18:41:23 +00:00
store i8 * * %argv , i8 * * * %argv.addr , align 8
2015-05-27 18:44:32 +00:00
call void @llvm.dbg.declare ( metadata i8 * * * %argv.addr , metadata !16 , metadata !DIExpression ( ) ) , !dbg !15
%0 = load i32 , i32 * %argc.addr , align 4 , !dbg !17
%1 = load i8 * * , i8 * * * %argv.addr , align 8 , !dbg !17
2013-04-08 18:41:23 +00:00
call void @test ( i32 %0 , i8 * * %1 ) , !dbg !17
ret i32 0 , !dbg !19
}
2015-01-18 16:17:27 +00:00
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) nounwind readnone
2013-04-08 18:41:23 +00:00
declare void @test ( i32 , i8 * * )
!llvm.dbg.cu = ! { !0 }
2013-12-22 00:04:03 +00:00
!llvm.module.flags = ! { !21 }
2013-04-08 18:41:23 +00:00
2016-07-23 20:41:05 +00:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , producer: "clang version 3.3 (trunk 173515)" , isOptimized: true , emissionKind: F u l l D e b u g , file: !20 , enums: !2 , retainedTypes: !2 , globals: !2 )
2015-05-27 18:44:32 +00:00
!2 = ! { }
2016-07-23 20:41:05 +00:00
!5 = distinct !DISubprogram ( name: "main" , line: 3 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !0 , scopeLine: 4 , file: !20 , scope: null , type: !7 , variables: !2 )
2015-05-27 18:44:32 +00:00
!6 = !DIFile ( filename: "main.cpp" , directory: "/private/tmp" )
!7 = !DISubroutineType ( types: !8 )
2015-01-18 16:17:27 +00:00
!8 = ! { !9 , !9 , !10 }
2015-05-27 18:44:32 +00:00
!9 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!10 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 64 , align: 64 , baseType: !11 )
!11 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 64 , align: 64 , baseType: !12 )
!12 = !DIDerivedType ( tag: D W _ T A G _ c o n s t _ type , baseType: !13 )
!13 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "char" , size: 8 , align: 8 , encoding: D W _ A T E _ s i g n e d _ c h a r )
2015-12-30 11:46:15 +00:00
!14 = !DILocalVariable ( name: "argc" , line: 3 , arg: 1 , scope: !5 , file: !6 , type: !9 )
2015-05-27 18:44:32 +00:00
!15 = !DILocation ( line: 3 , scope: !5 )
2015-12-30 11:46:15 +00:00
!16 = !DILocalVariable ( name: "argv" , line: 3 , arg: 2 , scope: !5 , file: !6 , type: !10 )
2015-05-27 18:44:32 +00:00
!17 = !DILocation ( line: 5 , scope: !18 )
!18 = distinct !DILexicalBlock ( line: 4 , column: 0 , file: !20 , scope: !5 )
!19 = !DILocation ( line: 6 , scope: !18 )
!20 = !DIFile ( filename: "main.cpp" , directory: "/private/tmp" )
!21 = ! { i32 1 , !"Debug Info Version" , i32 3 }