146 lines · plain
1; RUN: llc < %s -filetype=obj -o - | llvm-readobj - --codeview | FileCheck %s2; RUN: llc < %s -o - | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s3 4; We used to crash on this input because UnicodeString is a forward declaration5; with no size. Our array type logic wanted to assert the size of the elements6; times the length matched the overall size.7 8; C++ source to regenerate:9; struct UnicodeString;10; struct GetFwdDecl {11; static UnicodeString format;12; };13; GetFwdDecl force_fwd_decl;14; struct UnicodeString {15; private:16; virtual ~UnicodeString();17; };18; struct UseCompleteType {19; UseCompleteType();20; ~UseCompleteType();21; UnicodeString currencySpcAfterSym[1];22; };23; UseCompleteType require_complete;24 25; CHECK: Array ({{.*}}) {26; CHECK-NEXT: TypeLeafKind: LF_ARRAY (0x1503)27; CHECK-NEXT: ElementType: UnicodeString28; CHECK-NEXT: IndexType: unsigned __int64 (0x23)29; CHECK-NEXT: SizeOf: 830; CHECK-NEXT: Name:31; CHECK-NEXT: }32 33; ModuleID = 't.cpp'34source_filename = "t.cpp"35target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"36target triple = "x86_64-pc-windows-msvc"37 38%struct.GetFwdDecl = type { i8 }39%struct.UseCompleteType = type { [1 x %struct.UnicodeString] }40%struct.UnicodeString = type { ptr }41 42$"\01??_DUseCompleteType@@QEAA@XZ" = comdat any43 44@"\01?force_fwd_decl@@3UGetFwdDecl@@A" = global %struct.GetFwdDecl zeroinitializer, align 1, !dbg !045@"\01?require_complete@@3UUseCompleteType@@A" = global %struct.UseCompleteType zeroinitializer, align 8, !dbg !646@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_t.cpp, ptr null }]47 48; Function Attrs: nounwind49define internal void @"\01??__Erequire_complete@@YAXXZ"() #0 !dbg !27 {50entry:51 %call = call ptr @"\01??0UseCompleteType@@QEAA@XZ"(ptr @"\01?require_complete@@3UUseCompleteType@@A"), !dbg !3052 %0 = call i32 @atexit(ptr @"\01??__Frequire_complete@@YAXXZ") #2, !dbg !3053 ret void, !dbg !3054}55 56declare ptr @"\01??0UseCompleteType@@QEAA@XZ"(ptr returned) unnamed_addr #157 58; Function Attrs: nounwind59define linkonce_odr void @"\01??_DUseCompleteType@@QEAA@XZ"(ptr %this) unnamed_addr #0 comdat align 2 !dbg !31 {60entry:61 %this.addr = alloca ptr, align 862 store ptr %this, ptr %this.addr, align 863 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !32, metadata !34), !dbg !3564 %this1 = load ptr, ptr %this.addr, align 865 call void @"\01??1UseCompleteType@@QEAA@XZ"(ptr %this1), !dbg !3666 ret void, !dbg !3667}68 69; Function Attrs: nounwind70 71define internal void @"\01??__Frequire_complete@@YAXXZ"() #0 !dbg !37 {72entry:73 call void @"\01??_DUseCompleteType@@QEAA@XZ"(ptr @"\01?require_complete@@3UUseCompleteType@@A"), !dbg !3874 ret void, !dbg !3975}76 77; Function Attrs: nounwind78declare i32 @atexit(ptr) #279 80; Function Attrs: nounwind readnone81declare void @llvm.dbg.declare(metadata, metadata, metadata) #382 83declare void @"\01??1UseCompleteType@@QEAA@XZ"(ptr) unnamed_addr #184 85; Function Attrs: nounwind86define internal void @_GLOBAL__sub_I_t.cpp() #0 !dbg !41 {87entry:88 call void @"\01??__Erequire_complete@@YAXXZ"(), !dbg !4389 ret void90}91 92attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }93attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }94attributes #2 = { nounwind }95attributes #3 = { nounwind readnone }96 97!llvm.dbg.cu = !{!2}98!llvm.module.flags = !{!24, !25}99!llvm.ident = !{!26}100 101!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression())102!1 = !DIGlobalVariable(name: "force_fwd_decl", linkageName: "\01?force_fwd_decl@@3UGetFwdDecl@@A", scope: !2, file: !8, line: 5, type: !21, isLocal: false, isDefinition: true)103!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 4.0.0 (trunk 281056) (llvm/trunk 281051)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)104!3 = !DIFile(filename: "<stdin>", directory: "C:\5Csrc\5Cllvm\5Cbuild")105!4 = !{}106!5 = !{!0, !6}107!6 = distinct !DIGlobalVariableExpression(var: !7, expr: !DIExpression())108!7 = !DIGlobalVariable(name: "require_complete", linkageName: "\01?require_complete@@3UUseCompleteType@@A", scope: !2, file: !8, line: 15, type: !9, isLocal: false, isDefinition: true)109!8 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm\5Cbuild")110!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UseCompleteType", file: !8, line: 10, size: 64, align: 64, elements: !10, identifier: ".?AUUseCompleteType@@")111!10 = !{!11, !16, !20}112!11 = !DIDerivedType(tag: DW_TAG_member, name: "currencySpcAfterSym", scope: !9, file: !8, line: 13, baseType: !12, size: 64, align: 64)113!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 64, align: 64, elements: !14)114!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "UnicodeString", file: !8, line: 1, flags: DIFlagFwdDecl, identifier: ".?AUUnicodeString@@")115!14 = !{!15}116!15 = !DISubrange(count: 1)117!16 = !DISubprogram(name: "UseCompleteType", scope: !9, file: !8, line: 11, type: !17, isLocal: false, isDefinition: false, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false)118!17 = !DISubroutineType(types: !18)119!18 = !{null, !19}120!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)121!20 = !DISubprogram(name: "~UseCompleteType", scope: !9, file: !8, line: 12, type: !17, isLocal: false, isDefinition: false, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false)122!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "GetFwdDecl", file: !8, line: 2, size: 8, align: 8, elements: !22, identifier: ".?AUGetFwdDecl@@")123!22 = !{!23}124!23 = !DIDerivedType(tag: DW_TAG_member, name: "format", scope: !21, file: !8, line: 3, baseType: !13, flags: DIFlagStaticMember)125!24 = !{i32 2, !"CodeView", i32 1}126!25 = !{i32 2, !"Debug Info Version", i32 3}127!26 = !{!"clang version 4.0.0 (trunk 281056) (llvm/trunk 281051)"}128!27 = distinct !DISubprogram(name: "??__Erequire_complete@@YAXXZ", scope: !8, file: !8, line: 15, type: !28, isLocal: true, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)129!28 = !DISubroutineType(types: !29)130!29 = !{null}131!30 = !DILocation(line: 15, scope: !27)132!31 = distinct !DISubprogram(name: "~UseCompleteType", linkageName: "\01??_DUseCompleteType@@QEAA@XZ", scope: !9, file: !8, line: 12, type: !17, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: false, unit: !2, declaration: !20, retainedNodes: !4)133!32 = !DILocalVariable(name: "this", arg: 1, scope: !31, type: !33, flags: DIFlagArtificial | DIFlagObjectPointer)134!33 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64)135!34 = !DIExpression()136!35 = !DILocation(line: 0, scope: !31)137!36 = !DILocation(line: 15, scope: !31)138!37 = distinct !DISubprogram(name: "??__Frequire_complete@@YAXXZ", scope: !3, file: !3, line: 15, type: !28, isLocal: true, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)139!38 = !DILocation(line: 15, scope: !37)140!39 = !DILocation(line: 15, scope: !40)141!40 = !DILexicalBlockFile(scope: !37, file: !8, discriminator: 0)142!41 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_t.cpp", scope: !3, file: !3, type: !42, isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !2, retainedNodes: !4)143!42 = !DISubroutineType(types: !4)144!43 = !DILocation(line: 0, scope: !41)145 146