2015-01-08 04:48:58 +08:00
|
|
|
; RUN: llc %s -filetype=obj -o %t.o
|
2017-09-12 06:59:45 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s
|
2015-01-08 04:48:58 +08:00
|
|
|
; Test emitting a constant for an aggregate type.
|
|
|
|
;
|
|
|
|
; clang -S -O1 -emit-llvm
|
|
|
|
;
|
|
|
|
; typedef struct { unsigned i; } S;
|
|
|
|
;
|
|
|
|
; unsigned foo(S s) {
|
|
|
|
; s.i = 1;
|
|
|
|
; return s.i;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; class C { public: unsigned i; };
|
|
|
|
;
|
|
|
|
; unsigned foo(C c) {
|
|
|
|
; c.i = 2;
|
|
|
|
; return c.i;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; unsigned bar() {
|
|
|
|
; int a[1] = { 3 };
|
|
|
|
; return a[0];
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; CHECK: DW_TAG_formal_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (1)
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}} "s"
|
|
|
|
;
|
|
|
|
; CHECK: DW_TAG_formal_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (2)
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}} "c"
|
|
|
|
;
|
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (3)
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}} "a"
|
|
|
|
|
|
|
|
; ModuleID = 'sroasplit-4.cpp'
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-macosx10.10.0"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone ssp uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @_Z3foo1S(i32 %s.coerce) #0 !dbg !12 {
|
2015-01-08 04:48:58 +08:00
|
|
|
entry:
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %s.coerce, metadata !18, metadata !37), !dbg !38
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 1, metadata !18, metadata !37), !dbg !38
|
2015-01-08 04:48:58 +08:00
|
|
|
ret i32 1, !dbg !39
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone ssp uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @_Z3foo1C(i32 %c.coerce) #0 !dbg !19 {
|
2015-01-08 04:48:58 +08:00
|
|
|
entry:
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %c.coerce, metadata !23, metadata !37), !dbg !40
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 2, metadata !23, metadata !37), !dbg !40
|
2015-01-08 04:48:58 +08:00
|
|
|
ret i32 2, !dbg !41
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone ssp uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @_Z3barv() #0 !dbg !24 {
|
2015-01-08 04:48:58 +08:00
|
|
|
entry:
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 3, metadata !28, metadata !37), !dbg !42
|
2015-01-08 04:48:58 +08:00
|
|
|
ret i32 3, !dbg !43
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2017-07-29 04:21:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
|
2015-01-08 04:48:58 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone ssp uwtable }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!33, !34, !35}
|
|
|
|
!llvm.ident = !{!36}
|
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 225364) (llvm/trunk 225366)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!1 = !DIFile(filename: "sroasplit-4.cpp", directory: "")
|
2015-01-08 04:48:58 +08:00
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4, !8}
|
2015-04-30 00:38:44 +08:00
|
|
|
!4 = !DICompositeType(tag: DW_TAG_structure_type, line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1S")
|
2015-01-08 04:48:58 +08:00
|
|
|
!5 = !{!6}
|
2016-04-24 05:08:00 +08:00
|
|
|
!6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !4, baseType: !7)
|
2015-04-30 00:38:44 +08:00
|
|
|
!7 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
|
|
|
|
!8 = !DICompositeType(tag: DW_TAG_class_type, name: "C", line: 8, size: 32, align: 32, file: !1, elements: !9, identifier: "_ZTS1C")
|
2015-01-08 04:48:58 +08:00
|
|
|
!9 = !{!10}
|
2016-04-24 05:08:00 +08:00
|
|
|
!10 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 8, size: 32, align: 32, flags: DIFlagPublic, file: !1, scope: !8, baseType: !7)
|
2016-04-15 23:57:41 +08:00
|
|
|
!12 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foo1S", line: 3, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !13, type: !14, variables: !17)
|
2015-04-30 00:38:44 +08:00
|
|
|
!13 = !DIFile(filename: "sroasplit-4.cpp", directory: "")
|
|
|
|
!14 = !DISubroutineType(types: !15)
|
2015-01-08 04:48:58 +08:00
|
|
|
!15 = !{!7, !16}
|
2016-04-24 05:08:00 +08:00
|
|
|
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "S", line: 1, file: !1, baseType: !4)
|
2015-01-08 04:48:58 +08:00
|
|
|
!17 = !{!18}
|
2015-08-01 02:58:39 +08:00
|
|
|
!18 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !12, file: !13, type: !16)
|
2016-04-15 23:57:41 +08:00
|
|
|
!19 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foo1C", line: 10, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 10, file: !1, scope: !13, type: !20, variables: !22)
|
2015-04-30 00:38:44 +08:00
|
|
|
!20 = !DISubroutineType(types: !21)
|
2016-04-24 05:08:00 +08:00
|
|
|
!21 = !{!7, !8}
|
2015-01-08 04:48:58 +08:00
|
|
|
!22 = !{!23}
|
2016-04-24 05:08:00 +08:00
|
|
|
!23 = !DILocalVariable(name: "c", line: 10, arg: 1, scope: !19, file: !13, type: !8)
|
2016-04-15 23:57:41 +08:00
|
|
|
!24 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 15, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 15, file: !1, scope: !13, type: !25, variables: !27)
|
2015-04-30 00:38:44 +08:00
|
|
|
!25 = !DISubroutineType(types: !26)
|
2015-01-08 04:48:58 +08:00
|
|
|
!26 = !{!7}
|
|
|
|
!27 = !{!28}
|
2015-08-01 02:58:39 +08:00
|
|
|
!28 = !DILocalVariable(name: "a", line: 16, scope: !24, file: !13, type: !29)
|
2015-04-30 00:38:44 +08:00
|
|
|
!29 = !DICompositeType(tag: DW_TAG_array_type, size: 32, align: 32, baseType: !30, elements: !31)
|
|
|
|
!30 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2015-01-08 04:48:58 +08:00
|
|
|
!31 = !{!32}
|
2015-04-30 00:38:44 +08:00
|
|
|
!32 = !DISubrange(count: 1)
|
2015-01-08 04:48:58 +08:00
|
|
|
!33 = !{i32 2, !"Dwarf Version", i32 2}
|
2015-03-04 01:24:31 +08:00
|
|
|
!34 = !{i32 2, !"Debug Info Version", i32 3}
|
2015-01-08 04:48:58 +08:00
|
|
|
!35 = !{i32 1, !"PIC Level", i32 2}
|
|
|
|
!36 = !{!"clang version 3.6.0 (trunk 225364) (llvm/trunk 225366)"}
|
2015-04-30 00:38:44 +08:00
|
|
|
!37 = !DIExpression()
|
|
|
|
!38 = !DILocation(line: 3, column: 16, scope: !12)
|
|
|
|
!39 = !DILocation(line: 5, column: 3, scope: !12)
|
|
|
|
!40 = !DILocation(line: 10, column: 16, scope: !19)
|
|
|
|
!41 = !DILocation(line: 12, column: 3, scope: !19)
|
|
|
|
!42 = !DILocation(line: 16, column: 6, scope: !24)
|
|
|
|
!43 = !DILocation(line: 17, column: 3, scope: !24)
|